diff --git a/crawlers/deploy/mumbai-historical-crawl-events.service b/crawlers/deploy/amoy-historical-crawl-events.service similarity index 57% rename from crawlers/deploy/mumbai-historical-crawl-events.service rename to crawlers/deploy/amoy-historical-crawl-events.service index 6922c827..8cc58f29 100644 --- a/crawlers/deploy/mumbai-historical-crawl-events.service +++ b/crawlers/deploy/amoy-historical-crawl-events.service @@ -1,5 +1,5 @@ [Unit] -Description=Mumbai historical crawler events +Description=Amoy historical crawler events After=network.target StartLimitIntervalSec=300 StartLimitBurst=3 @@ -9,9 +9,9 @@ WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env Restart=on-failure RestartSec=15s -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type mumbai --find-deployed-blocks --end 0 --tasks-journal --only-events +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type amoy --find-deployed-blocks --end 0 --tasks-journal --only-events CPUWeight=70 -SyslogIdentifier=mumbai-historical-crawl-events +SyslogIdentifier=amoy-historical-crawl-events [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/crawlers/deploy/mumbai-historical-crawl-events.timer b/crawlers/deploy/amoy-historical-crawl-events.timer similarity index 61% rename from crawlers/deploy/mumbai-historical-crawl-events.timer rename to crawlers/deploy/amoy-historical-crawl-events.timer index 8fd46b46..dc29684f 100644 --- a/crawlers/deploy/mumbai-historical-crawl-events.timer +++ b/crawlers/deploy/amoy-historical-crawl-events.timer @@ -1,5 +1,5 @@ [Unit] -Description=Runs events historical crawler on mumbai +Description=Runs events historical crawler on Amoy [Timer] OnBootSec=60s diff --git a/crawlers/deploy/mumbai-historical-crawl-transactions.service b/crawlers/deploy/amoy-historical-crawl-transactions.service similarity index 55% rename from crawlers/deploy/mumbai-historical-crawl-transactions.service rename to crawlers/deploy/amoy-historical-crawl-transactions.service index 7f73450e..500eb3fa 100644 --- a/crawlers/deploy/mumbai-historical-crawl-transactions.service +++ b/crawlers/deploy/amoy-historical-crawl-transactions.service @@ -1,5 +1,5 @@ [Unit] -Description=Mumbai historical crawler transactions +Description=Amoy historical crawler transactions After=network.target StartLimitIntervalSec=300 StartLimitBurst=3 @@ -9,9 +9,9 @@ WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env Restart=on-failure RestartSec=15s -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type mumbai --find-deployed-blocks --end 0 --tasks-journal --only-functions +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type amoy --find-deployed-blocks --end 0 --tasks-journal --only-functions CPUWeight=70 -SyslogIdentifier=mumbai-historical-crawl-transactions +SyslogIdentifier=amoy-historical-crawl-transactions [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/crawlers/deploy/mumbai-historical-crawl-transactions.timer b/crawlers/deploy/amoy-historical-crawl-transactions.timer similarity index 58% rename from crawlers/deploy/mumbai-historical-crawl-transactions.timer rename to crawlers/deploy/amoy-historical-crawl-transactions.timer index b1c8d824..2ba29366 100644 --- a/crawlers/deploy/mumbai-historical-crawl-transactions.timer +++ b/crawlers/deploy/amoy-historical-crawl-transactions.timer @@ -1,5 +1,5 @@ [Unit] -Description=Runs transactions historical crawler on mumbai +Description=Runs transactions historical crawler on Amoy [Timer] OnBootSec=60s diff --git a/crawlers/deploy/deploy-basic.bash b/crawlers/deploy/deploy-basic.bash index eee32797..297b5b46 100755 --- a/crawlers/deploy/deploy-basic.bash +++ b/crawlers/deploy/deploy-basic.bash @@ -43,11 +43,6 @@ POLYGON_MISSING_TIMER_FILE="polygon-missing.timer" POLYGON_CU_NFT_DASHBOARD_SERVICE_FILE="polygon-cu-nft-dashboard.service" POLYGON_CU_NFT_DASHBOARD_TIMER_FILE="polygon-cu-nft-dashboard.timer" -# Mumbai service files -MUMBAI_SYNCHRONIZE_SERVICE="mumbai-synchronize.service" -MUMBAI_MISSING_SERVICE_FILE="mumbai-missing.service" -MUMBAI_MISSING_TIMER_FILE="mumbai-missing.timer" - # Amoy AMOY_MISSING_SERVICE_FILE="amoy-missing.service" AMOY_MISSING_TIMER_FILE="amoy-missing.timer" @@ -108,6 +103,11 @@ BLAST_SEPOLIA_MISSING_SERVICE_FILE="blast-sepolia-missing.service" BLAST_SEPOLIA_MISSING_TIMER_FILE="blast-sepolia-missing.timer" BLAST_SEPOLIA_SYNCHRONIZE_SERVICE="blast-sepolia-synchronize.service" +# ProofofPlay APEX +PROOFOFPLAY_APEX_MISSING_SERVICE_FILE="proofofplay-apex-missing.service" +PROOFOFPLAY_APEX_MISSING_TIMER_FILE="proofofplay-apex-missing.timer" +PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE="proofofplay-apex-synchronize.service" + set -eu echo @@ -423,3 +423,21 @@ cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/s cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MISSING_TIMER_FILE}" XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_MISSING_TIMER_FILE}" + +# Proofofplay Apex +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex block with transactions syncronizer service definition with ${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex missing service and timer with: ${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}, ${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" diff --git a/crawlers/deploy/deploy-historical.bash b/crawlers/deploy/deploy-historical.bash index a386fb17..bfd162e8 100755 --- a/crawlers/deploy/deploy-historical.bash +++ b/crawlers/deploy/deploy-historical.bash @@ -36,11 +36,11 @@ POLYGON_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="polygon-historical-crawl-trans POLYGON_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="polygon-historical-crawl-events.service" POLYGON_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="polygon-historical-crawl-events.timer" -# Mumbai service files -MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="mumbai-historical-crawl-transactions.service" -MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="mumbai-historical-crawl-transactions.timer" -MUMBAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="mumbai-historical-crawl-events.service" -MUMBAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="mumbai-historical-crawl-events.timer" +# Amoy service files +AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="amoy-historical-crawl-transactions.service" +AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="amoy-historical-crawl-transactions.timer" +AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="amoy-historical-crawl-events.service" +AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="amoy-historical-crawl-events.timer" # XDai service files XDai_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="xdai-historical-crawl-transactions.service" @@ -60,6 +60,12 @@ ZKSYNC_ERA_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="zksync-era-sepolia- ZKSYNC_ERA_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="zksync-era-sepolia-historical-crawl-events.service" ZKSYNC_ERA_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="zksync-era-sepolia-historical-crawl-events.timer" +# ProofofPlay APEX +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="proofofplay-apex-historical-crawl-transactions.service" +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="proofofplay-apex-historical-crawl-transactions.timer" +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="proofofplay-apex-historical-crawl-events.service" +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="proofofplay-apex-historical-crawl-events.timer" + set -eu echo @@ -137,21 +143,21 @@ XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${POLYGON_ echo echo -echo -e "${PREFIX_INFO} Replacing existing MUMBAI historical transactions crawler service and timer with: ${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" -chmod 644 "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +echo -e "${PREFIX_INFO} Replacing existing Amoy historical transactions crawler service and timer with: ${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" echo echo -echo -e "${PREFIX_INFO} Replacing existing MUMBAI historical events crawler service and timer with: ${MUMBAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${MUMBAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" -chmod 644 "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +echo -e "${PREFIX_INFO} Replacing existing Amoy historical events crawler service and timer with: ${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" echo echo @@ -206,3 +212,21 @@ cp "${SCRIPT_DIR}/${ZKSYNC_ERA_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/ cp "${SCRIPT_DIR}/${ZKSYNC_ERA_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${ZKSYNC_ERA_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${ZKSYNC_ERA_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex historical transactions crawler service and timer with: ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex historical events crawler service and timer with: ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" diff --git a/crawlers/deploy/deploy-moonworm.bash b/crawlers/deploy/deploy-moonworm.bash index f69fca28..56641352 100755 --- a/crawlers/deploy/deploy-moonworm.bash +++ b/crawlers/deploy/deploy-moonworm.bash @@ -27,7 +27,6 @@ SCRIPT_DIR="$(realpath $(dirname $0))" # Service files ETHEREUM_MOONWORM_CRAWLER_SERVICE_FILE="ethereum-moonworm-crawler.service" POLYGON_MOONWORM_CRAWLER_SERVICE_FILE="polygon-moonworm-crawler.service" -MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE="mumbai-moonworm-crawler.service" AMOY_MOONWORM_CRAWLER_SERVICE_FILE="amoy-moonworm-crawler.service" XDAI_MOONWORM_CRAWLER_SERVICE_FILE="xdai-moonworm-crawler.service" ZKSYNC_ERA_MOONWORM_CRAWLER_SERVICE_FILE="zksync-era-moonworm-crawler.service" @@ -40,6 +39,7 @@ AVALANCHE_MOONWORM_CRAWLER_SERVICE_FILE="avalanche-moonworm-crawler.service" AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE="avalanche-fuji-moonworm-crawler.service" BLAST_MOONWORM_CRAWLER_SERVICE_FILE="blast-moonworm-crawler.service" BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="blast-sepolia-moonworm-crawler.service" +PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE="proofofplay-apex-moonworm-crawler.service" set -eu @@ -191,3 +191,11 @@ chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex moonworm crawler service definition with ${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" diff --git a/crawlers/deploy/deploy-state.bash b/crawlers/deploy/deploy-state.bash index 59982544..2bdba2a0 100755 --- a/crawlers/deploy/deploy-state.bash +++ b/crawlers/deploy/deploy-state.bash @@ -40,14 +40,6 @@ POLYGON_STATE_CLEAN_TIMER_FILE="polygon-state-clean.timer" POLYGON_METADATA_SERVICE_FILE="polygon-metadata.service" POLYGON_METADATA_TIMER_FILE="polygon-metadata.timer" -# Mumbai service files -MUMBAI_STATE_SERVICE_FILE="mumbai-state.service" -MUMBAI_STATE_TIMER_FILE="mumbai-state.timer" -MUMBAI_STATE_CLEAN_SERVICE_FILE="mumbai-state-clean.service" -MUMBAI_STATE_CLEAN_TIMER_FILE="mumbai-state-clean.timer" -MUMBAI_METADATA_SERVICE_FILE="mumbai-metadata.service" -MUMBAI_METADATA_TIMER_FILE="mumbai-metadata.timer" - # ZkSync Era ZKSYNC_ERA_STATE_SERVICE_FILE="zksync-era-state.service" ZKSYNC_ERA_STATE_TIMER_FILE="zksync-era-state.timer" @@ -147,33 +139,6 @@ cp "${SCRIPT_DIR}/${POLYGON_METADATA_TIMER_FILE}" "/home/ubuntu/.config/systemd/ XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${POLYGON_METADATA_TIMER_FILE}" -echo -echo -echo -e "${PREFIX_INFO} Replacing existing MUMBAI state service and timer with: ${MUMBAI_STATE_SERVICE_FILE}, ${MUMBAI_STATE_TIMER_FILE}" -chmod 644 "${SCRIPT_DIR}/${MUMBAI_STATE_SERVICE_FILE}" "${SCRIPT_DIR}/${MUMBAI_STATE_TIMER_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_STATE_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_STATE_SERVICE_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_STATE_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_STATE_TIMER_FILE}" -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_STATE_TIMER_FILE}" - -echo -echo -echo -e "${PREFIX_INFO} Replacing existing MUMBAI metadata service and timer with: ${MUMBAI_METADATA_SERVICE_FILE}, ${MUMBAI_METADATA_TIMER_FILE}" -chmod 644 "${SCRIPT_DIR}/${MUMBAI_METADATA_SERVICE_FILE}" "${SCRIPT_DIR}/${MUMBAI_METADATA_TIMER_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_METADATA_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_METADATA_SERVICE_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_METADATA_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_METADATA_TIMER_FILE}" -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_METADATA_TIMER_FILE}" - -echo -echo -echo -e "${PREFIX_INFO} Replacing existing MUMBAI state clean service and timer with: ${MUMBAI_STATE_CLEAN_SERVICE_FILE}, ${MUMBAI_STATE_CLEAN_TIMER_FILE}" -chmod 644 "${SCRIPT_DIR}/${MUMBAI_STATE_CLEAN_SERVICE_FILE}" "${SCRIPT_DIR}/${MUMBAI_STATE_CLEAN_TIMER_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_STATE_CLEAN_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_STATE_CLEAN_SERVICE_FILE}" -cp "${SCRIPT_DIR}/${MUMBAI_STATE_CLEAN_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_STATE_CLEAN_TIMER_FILE}" -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload -XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_STATE_CLEAN_TIMER_FILE}" - echo echo echo -e "${PREFIX_INFO} Replacing existing ZkSync Era state service and timer with: ${ZKSYNC_ERA_STATE_SERVICE_FILE}, ${ZKSYNC_ERA_STATE_TIMER_FILE}" diff --git a/crawlers/deploy/deploy.bash b/crawlers/deploy/deploy.bash index c0bcc6c5..8ae66295 100755 --- a/crawlers/deploy/deploy.bash +++ b/crawlers/deploy/deploy.bash @@ -65,27 +65,15 @@ POLYGON_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="polygon-historical-crawl-trans POLYGON_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="polygon-historical-crawl-events.service" POLYGON_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="polygon-historical-crawl-events.timer" -# Mumbai service files -MUMBAI_SYNCHRONIZE_SERVICE="mumbai-synchronize.service" -MUMBAI_MISSING_SERVICE_FILE="mumbai-missing.service" -MUMBAI_MISSING_TIMER_FILE="mumbai-missing.timer" -MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE="mumbai-moonworm-crawler.service" -MUMBAI_STATE_SERVICE_FILE="mumbai-state.service" -MUMBAI_STATE_TIMER_FILE="mumbai-state.timer" -MUMBAI_STATE_CLEAN_SERVICE_FILE="mumbai-state-clean.service" -MUMBAI_STATE_CLEAN_TIMER_FILE="mumbai-state-clean.timer" -MUMBAI_METADATA_SERVICE_FILE="mumbai-metadata.service" -MUMBAI_METADATA_TIMER_FILE="mumbai-metadata.timer" -MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="mumbai-historical-crawl-transactions.service" -MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="mumbai-historical-crawl-transactions.timer" -MUMBAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="mumbai-historical-crawl-events.service" -MUMBAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="mumbai-historical-crawl-events.timer" - # Amoy AMOY_MISSING_SERVICE_FILE="amoy-missing.service" AMOY_MISSING_TIMER_FILE="amoy-missing.timer" AMOY_MOONWORM_CRAWLER_SERVICE_FILE="amoy-moonworm-crawler.service" AMOY_SYNCHRONIZE_SERVICE="amoy-synchronize.service" +AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="amoy-historical-crawl-transactions.service" +AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="amoy-historical-crawl-transactions.timer" +AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="amoy-historical-crawl-events.service" +AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="amoy-historical-crawl-events.timer" # XDai service files XDAI_SYNCHRONIZE_SERVICE="xdai-synchronize.service" @@ -169,6 +157,17 @@ BLAST_SEPOLIA_MISSING_TIMER_FILE="blast-sepolia-missing.timer" BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="blast-sepolia-moonworm-crawler.service" BLAST_SEPOLIA_SYNCHRONIZE_SERVICE="blast-sepolia-synchronize.service" +# ProofofPlay APEX +PROOFOFPLAY_APEX_MISSING_SERVICE_FILE="proofofplay-apex-missing.service" +PROOFOFPLAY_APEX_MISSING_TIMER_FILE="proofofplay-apex-missing.timer" +PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE="proofofplay-apex-moonworm-crawler.service" +PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE="proofofplay-apex-synchronize.service" +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="proofofplay-apex-historical-crawl-transactions.service" +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="proofofplay-apex-historical-crawl-transactions.timer" +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="proofofplay-apex-historical-crawl-events.service" +PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="proofofplay-apex-historical-crawl-events.timer" + + set -eu echo @@ -403,6 +402,24 @@ cp "${SCRIPT_DIR}/${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/s XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}" +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Amoy historical transactions crawler service and timer with: ${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Amoy historical events crawler service and timer with: ${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" + # Xdai echo echo @@ -772,3 +789,49 @@ chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" + + +# Proofofplay Apex + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex block with transactions syncronizer service definition with ${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_SYNCHRONIZE_SERVICE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex missing service and timer with: ${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}, ${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_MISSING_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_MISSING_TIMER_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex moonworm crawler service definition with ${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_MOONWORM_CRAWLER_SERVICE_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex historical transactions crawler service and timer with: ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Proofofplay Apex historical events crawler service and timer with: ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload +XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${PROOFOFPLAY_APEX_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" diff --git a/crawlers/deploy/monitoring-crawlers.service b/crawlers/deploy/monitoring-crawlers.service index e8f7c07d..1dfc2a86 100644 --- a/crawlers/deploy/monitoring-crawlers.service +++ b/crawlers/deploy/monitoring-crawlers.service @@ -9,7 +9,7 @@ Restart=on-failure RestartSec=15s WorkingDirectory=/home/ubuntu/ EnvironmentFile=/home/ubuntu/moonstream-secrets/monitoring.env -ExecStart=/home/ubuntu/monitoring -plugin systemd -host "${AWS_LOCAL_IPV4}" -port 7171 -healthcheck -server -threshold 3 -config /home/ubuntu/.monitoring/monitoring-crawlers-config.json -service ethereum-moonworm-crawler.service -service amoy-moonworm-crawler.service -service polygon-moonworm-crawler.service -service zksync-era-moonworm-crawler.service -service zksync-era-sepolia-moonworm-crawler.service -service arbitrum-nova-moonworm-crawler.service -service arbitrum-sepolia-moonworm-crawler.service -service xai-moonworm-crawler.service -service xai-sepolia-moonworm-crawler.service -service avalanche-moonworm-crawler.service -service avalanche-fuji-moonworm-crawler.service -service blast-moonworm-crawler.service -service blast-sepolia-moonworm-crawler.service +ExecStart=/home/ubuntu/monitoring -plugin systemd -host "${AWS_LOCAL_IPV4}" -port 7171 -healthcheck -server -threshold 3 -config /home/ubuntu/.monitoring/monitoring-crawlers-config.json -service ethereum-moonworm-crawler.service -service amoy-moonworm-crawler.service -service polygon-moonworm-crawler.service -service zksync-era-moonworm-crawler.service -service zksync-era-sepolia-moonworm-crawler.service -service arbitrum-nova-moonworm-crawler.service -service arbitrum-sepolia-moonworm-crawler.service -service xai-moonworm-crawler.service -service xai-sepolia-moonworm-crawler.service -service avalanche-moonworm-crawler.service -service avalanche-fuji-moonworm-crawler.service -service blast-moonworm-crawler.service -service blast-sepolia-moonworm-crawler.service -service proofofplay-apex-crawler.service CPUWeight=90 SyslogIdentifier=monitoring-crawlers diff --git a/crawlers/deploy/mumbai-metadata.service b/crawlers/deploy/mumbai-metadata.service deleted file mode 100644 index 932fcd0a..00000000 --- a/crawlers/deploy/mumbai-metadata.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Execute metadata crawler -After=network.target - -[Service] -Type=oneshot -WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl -EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.metadata_crawler.cli crawl --blockchain mumbai -CPUWeight=60 -SyslogIdentifier=mumbai-metadata \ No newline at end of file diff --git a/crawlers/deploy/mumbai-metadata.timer b/crawlers/deploy/mumbai-metadata.timer deleted file mode 100644 index a628bc0c..00000000 --- a/crawlers/deploy/mumbai-metadata.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Execute Mumbai metadata crawler each 10m - -[Timer] -OnBootSec=20s -OnUnitActiveSec=60m - -[Install] -WantedBy=timers.target diff --git a/crawlers/deploy/mumbai-state-clean.service b/crawlers/deploy/mumbai-state-clean.service deleted file mode 100644 index cce345cb..00000000 --- a/crawlers/deploy/mumbai-state-clean.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Execute state clean labels crawler -After=network.target - -[Service] -Type=oneshot -WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl -EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli clean-state-labels --blockchain mumbai -N 10000 -CPUWeight=60 -SyslogIdentifier=mumbai-state-clean \ No newline at end of file diff --git a/crawlers/deploy/mumbai-state-clean.timer b/crawlers/deploy/mumbai-state-clean.timer deleted file mode 100644 index e29cd6a8..00000000 --- a/crawlers/deploy/mumbai-state-clean.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Execute Mumbai state clean labels crawler each 25m - -[Timer] -OnBootSec=50s -OnUnitActiveSec=25m - -[Install] -WantedBy=timers.target diff --git a/crawlers/deploy/mumbai-state.service b/crawlers/deploy/mumbai-state.service deleted file mode 100644 index 51e573b3..00000000 --- a/crawlers/deploy/mumbai-state.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Execute state crawler -After=network.target - -[Service] -Type=oneshot -WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl -EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain mumbai --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/mumbai-jobs.json -CPUWeight=60 -SyslogIdentifier=mumbai-state \ No newline at end of file diff --git a/crawlers/deploy/mumbai-state.timer b/crawlers/deploy/mumbai-state.timer deleted file mode 100644 index 48e17e68..00000000 --- a/crawlers/deploy/mumbai-state.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Execute Mumbai state crawler each 10m - -[Timer] -OnBootSec=15s -OnUnitActiveSec=10m - -[Install] -WantedBy=timers.target diff --git a/crawlers/deploy/proofofplay-apex-historical-crawl-events.service b/crawlers/deploy/proofofplay-apex-historical-crawl-events.service new file mode 100644 index 00000000..48309bd8 --- /dev/null +++ b/crawlers/deploy/proofofplay-apex-historical-crawl-events.service @@ -0,0 +1,17 @@ +[Unit] +Description=ProofOfPlay historical crawler events +After=network.target +StartLimitIntervalSec=300 +StartLimitBurst=3 + +[Service] +WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl +EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env +Restart=on-failure +RestartSec=15s +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type proofofplay_apex --find-deployed-blocks --end 0 --tasks-journal --only-events +CPUWeight=70 +SyslogIdentifier=proofofplay-apex-historical-crawl-events + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/crawlers/deploy/proofofplay-apex-historical-crawl-events.timer b/crawlers/deploy/proofofplay-apex-historical-crawl-events.timer new file mode 100644 index 00000000..66f179e8 --- /dev/null +++ b/crawlers/deploy/proofofplay-apex-historical-crawl-events.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Runs events historical crawler on proofofplay apex + +[Timer] +OnBootSec=60s +OnUnitActiveSec=10m + +[Install] +WantedBy=timers.target diff --git a/crawlers/deploy/proofofplay-apex-historical-crawl-transactions.service b/crawlers/deploy/proofofplay-apex-historical-crawl-transactions.service new file mode 100644 index 00000000..522a1ecd --- /dev/null +++ b/crawlers/deploy/proofofplay-apex-historical-crawl-transactions.service @@ -0,0 +1,17 @@ +[Unit] +Description=ProofOfPlay historical crawler transactions +After=network.target +StartLimitIntervalSec=300 +StartLimitBurst=3 + +[Service] +WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl +EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env +Restart=on-failure +RestartSec=15s +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type proofofplay_apex --find-deployed-blocks --end 0 --tasks-journal --only-functions +CPUWeight=70 +SyslogIdentifier=proofofplay-apex-historical-crawl-transactions + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/crawlers/deploy/proofofplay-apex-historical-crawl-transactions.timer b/crawlers/deploy/proofofplay-apex-historical-crawl-transactions.timer new file mode 100644 index 00000000..025ad1ad --- /dev/null +++ b/crawlers/deploy/proofofplay-apex-historical-crawl-transactions.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Runs transactions historical crawler on proofofplay apex + +[Timer] +OnBootSec=60s +OnUnitActiveSec=10m + +[Install] +WantedBy=timers.target diff --git a/crawlers/deploy/mumbai-missing.service b/crawlers/deploy/proofofplay-apex-missing.service similarity index 61% rename from crawlers/deploy/mumbai-missing.service rename to crawlers/deploy/proofofplay-apex-missing.service index 4e2cc4fb..a2724b62 100644 --- a/crawlers/deploy/mumbai-missing.service +++ b/crawlers/deploy/proofofplay-apex-missing.service @@ -1,11 +1,11 @@ [Unit] -Description=Fill missing blocks at Mumbai database +Description=Fill missing blocks at ProofOfPlay database After=network.target [Service] Type=oneshot WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain mumbai -n +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain proofofplay_apex -n CPUWeight=50 -SyslogIdentifier=mumbai-missing \ No newline at end of file +SyslogIdentifier=proofofplay-apex-missing \ No newline at end of file diff --git a/crawlers/deploy/mumbai-missing.timer b/crawlers/deploy/proofofplay-apex-missing.timer similarity index 60% rename from crawlers/deploy/mumbai-missing.timer rename to crawlers/deploy/proofofplay-apex-missing.timer index e3812f81..bfb85ed8 100644 --- a/crawlers/deploy/mumbai-missing.timer +++ b/crawlers/deploy/proofofplay-apex-missing.timer @@ -1,5 +1,5 @@ [Unit] -Description=Fill missing blocks at Mumbai database +Description=Fill missing blocks at ProofOfPlay database [Timer] OnBootSec=120s diff --git a/crawlers/deploy/mumbai-moonworm-crawler.service b/crawlers/deploy/proofofplay-apex-moonworm-crawler.service similarity index 60% rename from crawlers/deploy/mumbai-moonworm-crawler.service rename to crawlers/deploy/proofofplay-apex-moonworm-crawler.service index 3aa714ac..f2ff4bf8 100644 --- a/crawlers/deploy/mumbai-moonworm-crawler.service +++ b/crawlers/deploy/proofofplay-apex-moonworm-crawler.service @@ -1,5 +1,5 @@ [Unit] -Description=Mumbai moonworm crawler +Description=ProofOfPlay Apex moonworm crawler After=network.target StartLimitIntervalSec=300 StartLimitBurst=3 @@ -9,9 +9,9 @@ WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env Restart=on-failure RestartSec=15s -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b mumbai --confirmations 40 +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b proofofplay_apex --confirmations 50 --min-blocks-batch 20 CPUWeight=70 -SyslogIdentifier=mumbai-moonworm-crawler +SyslogIdentifier=proofofplay-apex-moonworm-crawler [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/crawlers/deploy/mumbai-synchronize.service b/crawlers/deploy/proofofplay-apex-synchronize.service similarity index 59% rename from crawlers/deploy/mumbai-synchronize.service rename to crawlers/deploy/proofofplay-apex-synchronize.service index 1486fcc5..e6b4c79e 100644 --- a/crawlers/deploy/mumbai-synchronize.service +++ b/crawlers/deploy/proofofplay-apex-synchronize.service @@ -1,5 +1,5 @@ [Unit] -Description=Mumbai block with transactions synchronizer +Description=ProofOfPlay Apex block with transactions synchronizer StartLimitIntervalSec=300 StartLimitBurst=3 After=network.target @@ -9,9 +9,9 @@ Restart=on-failure RestartSec=15s WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env -ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain mumbai -c 20 -j 2 +ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain proofofplay_apex --confirmations 40 --jobs 2 CPUWeight=90 -SyslogIdentifier=mumbai-synchronize +SyslogIdentifier=proofofplay-apex-synchronize [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/crawlers/mooncrawl/mooncrawl/blockchain.py b/crawlers/mooncrawl/mooncrawl/blockchain.py index 1551deb7..ddc93eee 100644 --- a/crawlers/mooncrawl/mooncrawl/blockchain.py +++ b/crawlers/mooncrawl/mooncrawl/blockchain.py @@ -32,6 +32,7 @@ from .settings import ( MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI, MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI, MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI, + MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI, MOONSTREAM_NODE_XAI_A_EXTERNAL_URI, MOONSTREAM_NODE_XAI_SEPOLIA_A_EXTERNAL_URI, MOONSTREAM_NODE_XDAI_A_EXTERNAL_URI, @@ -91,6 +92,8 @@ def connect( web3_uri = MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA: web3_uri = MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI + elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: + web3_uri = MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI else: raise Exception("Wrong blockchain type provided for web3 URI") @@ -175,6 +178,7 @@ def add_block(db_session, block: Any, blockchain_type: AvailableBlockchainType) elif ( blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA or blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA + or blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX ): block_obj.sha3_uncles = block.get("sha3Uncles", "") block_obj.l1_block_number = hex_to_int(block.get("l1BlockNumber")) @@ -255,6 +259,7 @@ def add_block_transactions( or blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA or blockchain_type == AvailableBlockchainType.XAI or blockchain_type == AvailableBlockchainType.XAI_SEPOLIA + or blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX ): tx_obj.y_parity = hex_to_int(tx.get("yParity")) diff --git a/crawlers/mooncrawl/mooncrawl/settings.py b/crawlers/mooncrawl/mooncrawl/settings.py index 35fe1764..f9a16b04 100644 --- a/crawlers/mooncrawl/mooncrawl/settings.py +++ b/crawlers/mooncrawl/mooncrawl/settings.py @@ -180,6 +180,15 @@ if MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI == "": "MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI env variable is not set" ) +MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI = os.environ.get( + "MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI", "" +) +if MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI == "": + raise Exception( + "MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI env variable is not set" + ) + + MOONSTREAM_CRAWL_WORKERS = 4 MOONSTREAM_CRAWL_WORKERS_RAW = os.environ.get("MOONSTREAM_CRAWL_WORKERS") try: diff --git a/crawlers/mooncrawl/mooncrawl/version.py b/crawlers/mooncrawl/mooncrawl/version.py index 6f915441..5cfca106 100644 --- a/crawlers/mooncrawl/mooncrawl/version.py +++ b/crawlers/mooncrawl/mooncrawl/version.py @@ -2,4 +2,4 @@ Moonstream crawlers version. """ -MOONCRAWL_VERSION = "0.4.3" +MOONCRAWL_VERSION = "0.4.4" diff --git a/crawlers/mooncrawl/sample.env b/crawlers/mooncrawl/sample.env index cce5e77f..88148683 100644 --- a/crawlers/mooncrawl/sample.env +++ b/crawlers/mooncrawl/sample.env @@ -23,6 +23,7 @@ export NFT_HUMBUG_TOKEN="" # Blockchain nodes environment variables export MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI="https://" export MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI="https://" +export MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI="https://" export MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI="https://" export MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI="https://" export MOONSTREAM_NODE_XDAI_A_EXTERNAL_URI="https://" diff --git a/crawlers/mooncrawl/setup.py b/crawlers/mooncrawl/setup.py index b271e111..7c6c41f6 100644 --- a/crawlers/mooncrawl/setup.py +++ b/crawlers/mooncrawl/setup.py @@ -37,7 +37,7 @@ setup( "bugout>=0.2.13", "chardet", "fastapi", - "moonstreamdb>=0.4.1", + "moonstreamdb>=0.4.2", "moonstream>=0.1.1", "moonworm[moonstream]>=0.6.2", "humbug", diff --git a/engineapi/engineapi/settings.py b/engineapi/engineapi/settings.py index 9a6b5698..d5d81b10 100644 --- a/engineapi/engineapi/settings.py +++ b/engineapi/engineapi/settings.py @@ -107,6 +107,7 @@ blockchain_names = [ "avalanche_fuji", "blast", "blast_sepolia", + "proofofplay_apex", ] for b in blockchain_names: diff --git a/moonstreamapi/configs/sample.env b/moonstreamapi/configs/sample.env index 3f17b0e4..e9d6e0c3 100644 --- a/moonstreamapi/configs/sample.env +++ b/moonstreamapi/configs/sample.env @@ -17,6 +17,7 @@ export MOONSTREAM_DATA_JOURNAL_ID="" export HUMBUG_TXPOOL_CLIENT_ID="" export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="https://" export MOONSTREAM_POLYGON_WEB3_PROVIDER_URI="https://" +export MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI="https://" export MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI="https://" export MOONSTREAM_AMOY_WEB3_PROVIDER_URI="https://" export MOONSTREAM_XDAI_WEB3_PROVIDER_URI="https://" diff --git a/moonstreamapi/moonstreamapi/admin/subscription_types.py b/moonstreamapi/moonstreamapi/admin/subscription_types.py index 71be9fe9..ca2f3d30 100644 --- a/moonstreamapi/moonstreamapi/admin/subscription_types.py +++ b/moonstreamapi/moonstreamapi/admin/subscription_types.py @@ -40,6 +40,17 @@ CANONICAL_SUBSCRIPTION_TYPES = { stripe_price_id=None, active=True, ), + "proofofplay_apex_smartcontract": SubscriptionTypeResourceData( + id="proofofplay_apex_smartcontract", + name="Proof of Play Apex smartcontracts", + blockchain="proofofplay_apex", + choices=["input:address", "tag:erc721"], + description="Contracts events and tx_calls of contract of Proof of Play Apex blockchain", + icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png", + stripe_product_id=None, + stripe_price_id=None, + active=True, + ), "mumbai_smartcontract": SubscriptionTypeResourceData( id="mumbai_smartcontract", name="Mumbai smartcontracts", @@ -227,6 +238,17 @@ CANONICAL_SUBSCRIPTION_TYPES = { stripe_price_id=None, active=False, ), + "proofofplay_apex_blockchain": SubscriptionTypeResourceData( + id="proofofplay_apex_blockchain", + name="Proof of Play Apex transactions", + blockchain="proofofplay_apex", + choices=["input:address", "tag:erc721"], + description="Transactions that have been mined into the Proof of Play Apex blockchain", + icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png", + stripe_product_id=None, + stripe_price_id=None, + active=False, + ), "mumbai_blockchain": SubscriptionTypeResourceData( id="mumbai_blockchain", name="Mumbai transactions", diff --git a/moonstreamapi/moonstreamapi/providers/__init__.py b/moonstreamapi/moonstreamapi/providers/__init__.py index 0068b2cd..5baf1461 100644 --- a/moonstreamapi/moonstreamapi/providers/__init__.py +++ b/moonstreamapi/moonstreamapi/providers/__init__.py @@ -49,6 +49,7 @@ class ReceivingEventsException(Exception): event_providers: Dict[str, Any] = { moonworm_provider.EthereumMoonwormProvider.event_type: moonworm_provider.EthereumMoonwormProvider, moonworm_provider.PolygonMoonwormProvider.event_type: moonworm_provider.PolygonMoonwormProvider, + moonworm_provider.ProofOfPlayApexMoonwormProvider.event_type: moonworm_provider.ProofOfPlayApexMoonwormProvider, moonworm_provider.MumbaiMoonwormProvider.event_type: moonworm_provider.MumbaiMoonwormProvider, moonworm_provider.AmoyMoonwormProvider.event_type: moonworm_provider.AmoyMoonwormProvider, moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider, @@ -65,6 +66,7 @@ event_providers: Dict[str, Any] = { moonworm_provider.BlastSepoliaMoonwormProvider.event_type: moonworm_provider.BlastSepoliaMoonwormProvider, transactions.EthereumTransactions.event_type: transactions.EthereumTransactions, transactions.PolygonTransactions.event_type: transactions.PolygonTransactions, + transactions.ProofOfPlayApexTransactions.event_type: transactions.ProofOfPlayApexTransactions, transactions.MumbaiTransactions.event_type: transactions.MumbaiTransactions, transactions.AmoyTransactions.event_type: transactions.AmoyTransactions, transactions.XDaiTransactions.event_type: transactions.XDaiTransactions, diff --git a/moonstreamapi/moonstreamapi/providers/moonworm_provider.py b/moonstreamapi/moonstreamapi/providers/moonworm_provider.py index 8c07c3ed..fa59237f 100644 --- a/moonstreamapi/moonstreamapi/providers/moonworm_provider.py +++ b/moonstreamapi/moonstreamapi/providers/moonworm_provider.py @@ -19,6 +19,7 @@ logger.setLevel(logging.WARN) ethereum_event_type = "ethereum_blockchain" polygon_event_type = "polygon_blockchain" +proofofplay_apex_event_type = "proofofplay_apex_blockchain" mumbai_event_type = "mumbai_blockchain" amoy_event_type = "amoy_blockchain" xdai_event_type = "xdai_blockchain" @@ -510,3 +511,10 @@ BlastSepoliaMoonwormProvider = MoonwormProvider( description="Provider for reviving transactions from Blast Sepolia tables.", streamboaundary_range_limit=2 * 60 * 60, ) + +ProofOfPlayApexMoonwormProvider = MoonwormProvider( + event_type="proofofplay_apex_smartcontract", + blockchain=AvailableBlockchainType("proofofplay_apex"), + description="Provider for reviving transactions from Proof of Play Apex tables.", + streamboaundary_range_limit=2 * 60 * 60, +) diff --git a/moonstreamapi/moonstreamapi/providers/transactions.py b/moonstreamapi/moonstreamapi/providers/transactions.py index 348286b5..3368f01c 100644 --- a/moonstreamapi/moonstreamapi/providers/transactions.py +++ b/moonstreamapi/moonstreamapi/providers/transactions.py @@ -559,3 +559,10 @@ BlastSepoliaTransactions = TransactionsProvider( description="Provider for resiving transactions from Blast Sepolia tables.", streamboaundary_range_limit=2 * 60 * 60, ) + +ProofOfPlayApexTransactions = TransactionsProvider( + event_type="proofofplay_apex_blockchain", + blockchain=AvailableBlockchainType("proofofplay_apex"), + description="Provider for resiving transactions from Proof of Play Apex tables.", + streamboaundary_range_limit=2 * 60 * 60, +) diff --git a/moonstreamapi/moonstreamapi/settings.py b/moonstreamapi/moonstreamapi/settings.py index 5f00a57a..ccbb6d79 100644 --- a/moonstreamapi/moonstreamapi/settings.py +++ b/moonstreamapi/moonstreamapi/settings.py @@ -214,6 +214,14 @@ if MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI == "": "MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI env variable is not set" ) +MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI = os.environ.get( + "MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI", "" +) +if MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI == "": + raise Exception( + "MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI env variable is not set" + ) + ## QueryAPI MOONSTREAM_S3_QUERIES_BUCKET = os.environ.get("MOONSTREAM_S3_QUERIES_BUCKET", "") @@ -264,6 +272,7 @@ THREAD_TIMEOUT_SECONDS = 10 multicall_contracts: Dict[AvailableBlockchainType, str] = { AvailableBlockchainType.POLYGON: "0xc8E51042792d7405184DfCa245F2d27B94D013b6", AvailableBlockchainType.MUMBAI: "0xe9939e7Ea7D7fb619Ac57f648Da7B1D425832631", + AvailableBlockchainType.AMOY: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.ETHEREUM: "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696", AvailableBlockchainType.ARBITRUM_NOVA: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.ARBITRUM_SEPOLIA: "0xcA11bde05977b3631167028862bE2a173976CA11", diff --git a/moonstreamapi/moonstreamapi/version.py b/moonstreamapi/moonstreamapi/version.py index a621a692..39eec17e 100644 --- a/moonstreamapi/moonstreamapi/version.py +++ b/moonstreamapi/moonstreamapi/version.py @@ -2,4 +2,4 @@ Moonstream library and API version. """ -MOONSTREAMAPI_VERSION = "0.4.1" +MOONSTREAMAPI_VERSION = "0.4.2" diff --git a/moonstreamapi/moonstreamapi/web3_provider.py b/moonstreamapi/moonstreamapi/web3_provider.py index b444c4b3..cdcdbea2 100644 --- a/moonstreamapi/moonstreamapi/web3_provider.py +++ b/moonstreamapi/moonstreamapi/web3_provider.py @@ -22,6 +22,7 @@ from .settings import ( MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI, MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI, MOONSTREAM_POLYGON_WEB3_PROVIDER_URI, + MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI, MOONSTREAM_WYRM_WEB3_PROVIDER_URI, MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI, MOONSTREAM_XAI_WEB3_PROVIDER_URI, @@ -103,6 +104,8 @@ def connect( web3_uri = MOONSTREAM_BLAST_WEB3_PROVIDER_URI elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA: web3_uri = MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI + elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: + web3_uri = MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI else: raise Exception("Wrong blockchain type provided for web3 URI") diff --git a/moonstreamapi/requirements.txt b/moonstreamapi/requirements.txt index cc509c0c..60915c97 100644 --- a/moonstreamapi/requirements.txt +++ b/moonstreamapi/requirements.txt @@ -37,7 +37,7 @@ lru-dict==1.1.8 Mako==1.2.3 MarkupSafe==2.1.1 moonstream==0.1.1 -moonstreamdb==0.4.1 +moonstreamdb==0.4.2 multiaddr==0.0.9 multidict==6.0.2 netaddr==0.8.0 diff --git a/moonstreamapi/setup.py b/moonstreamapi/setup.py index f998ee97..e3c14220 100644 --- a/moonstreamapi/setup.py +++ b/moonstreamapi/setup.py @@ -16,7 +16,7 @@ setup( "bugout>=0.2.15", "fastapi", "moonstream", - "moonstreamdb>=0.4.1", + "moonstreamdb>=0.4.2", "humbug", "pydantic==1.10.2", "pyevmasm", diff --git a/moonstreamdb/alembic/env.py b/moonstreamdb/alembic/env.py index 2d4c8c37..cce72799 100644 --- a/moonstreamdb/alembic/env.py +++ b/moonstreamdb/alembic/env.py @@ -79,6 +79,9 @@ from moonstreamdb.models import ( BlastSepoliaBlock, BlastSepoliaLabel, BlastSepoliaTransaction, + ProofOfPlayApexBlock, + ProofOfPlayApexLabel, + ProofOfPlayApexTransaction, ) @@ -138,6 +141,9 @@ def include_symbol(tablename, schema): BlastSepoliaBlock.__tablename__, BlastSepoliaLabel.__tablename__, BlastSepoliaTransaction.__tablename__, + ProofOfPlayApexBlock.__tablename__, + ProofOfPlayApexLabel.__tablename__, + ProofOfPlayApexTransaction.__tablename__, } diff --git a/moonstreamdb/alembic/versions/a1d9fab5f904_proofofplay_apex_blockchain.py b/moonstreamdb/alembic/versions/a1d9fab5f904_proofofplay_apex_blockchain.py new file mode 100644 index 00000000..140e871a --- /dev/null +++ b/moonstreamdb/alembic/versions/a1d9fab5f904_proofofplay_apex_blockchain.py @@ -0,0 +1,285 @@ +"""ProofOfPlay Apex blockchain + +Revision ID: a1d9fab5f904 +Revises: c8eaa4ff9d76 +Create Date: 2024-04-17 02:35:52.418934 + +""" + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = "a1d9fab5f904" +down_revision = "c8eaa4ff9d76" +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table( + "proofofplay_apex_blocks", + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("difficulty", sa.BigInteger(), nullable=True), + sa.Column("extra_data", sa.VARCHAR(length=128), nullable=True), + sa.Column("gas_limit", sa.BigInteger(), nullable=True), + sa.Column("gas_used", sa.BigInteger(), nullable=True), + sa.Column("base_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("logs_bloom", sa.VARCHAR(length=1024), nullable=True), + sa.Column("miner", sa.VARCHAR(length=256), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("parent_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("receipt_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("uncles", sa.VARCHAR(length=256), nullable=True), + sa.Column("size", sa.Integer(), nullable=True), + sa.Column("state_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("timestamp", sa.BigInteger(), nullable=True), + sa.Column("total_difficulty", sa.VARCHAR(length=256), nullable=True), + sa.Column("transactions_root", sa.VARCHAR(length=256), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.Column("sha3_uncles", sa.VARCHAR(length=256), nullable=True), + sa.Column("l1_block_number", sa.BigInteger(), nullable=True), + sa.Column("send_count", sa.BigInteger(), nullable=True), + sa.Column("send_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("mix_hash", sa.VARCHAR(length=256), nullable=True), + sa.PrimaryKeyConstraint( + "block_number", name=op.f("pk_proofofplay_apex_blocks") + ), + ) + op.create_index( + op.f("ix_proofofplay_apex_blocks_block_number"), + "proofofplay_apex_blocks", + ["block_number"], + unique=True, + ) + op.create_index( + op.f("ix_proofofplay_apex_blocks_hash"), + "proofofplay_apex_blocks", + ["hash"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_blocks_timestamp"), + "proofofplay_apex_blocks", + ["timestamp"], + unique=False, + ) + op.create_table( + "proofofplay_apex_labels", + sa.Column("id", sa.UUID(), nullable=False), + sa.Column("label", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=True), + sa.Column("address", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("label_data", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column("block_timestamp", sa.BigInteger(), nullable=True), + sa.Column("log_index", sa.Integer(), nullable=True), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.PrimaryKeyConstraint("id", name=op.f("pk_proofofplay_apex_labels")), + sa.UniqueConstraint("id", name=op.f("uq_proofofplay_apex_labels_id")), + ) + op.create_index( + op.f("ix_proofofplay_apex_labels_address"), + "proofofplay_apex_labels", + ["address"], + unique=False, + ) + op.create_index( + "ix_proofofplay_apex_labels_address_block_number", + "proofofplay_apex_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_proofofplay_apex_labels_address_block_timestamp", + "proofofplay_apex_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_labels_block_number"), + "proofofplay_apex_labels", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_labels_block_timestamp"), + "proofofplay_apex_labels", + ["block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_labels_label"), + "proofofplay_apex_labels", + ["label"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_labels_transaction_hash"), + "proofofplay_apex_labels", + ["transaction_hash"], + unique=False, + ) + op.create_table( + "proofofplay_apex_transactions", + sa.Column("hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("from_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("to_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("gas_price", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("max_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "max_priority_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True + ), + sa.Column("input", sa.Text(), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_index", sa.BigInteger(), nullable=True), + sa.Column("transaction_type", sa.Integer(), nullable=True), + sa.Column("value", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.Column("y_parity", sa.BigInteger(), nullable=True), + sa.ForeignKeyConstraint( + ["block_number"], + ["proofofplay_apex_blocks.block_number"], + name=op.f( + "fk_proofofplay_apex_transactions_block_number_proofofplay_apex_blocks" + ), + ondelete="CASCADE", + ), + sa.PrimaryKeyConstraint("hash", name=op.f("pk_proofofplay_apex_transactions")), + ) + op.create_index( + op.f("ix_proofofplay_apex_transactions_block_number"), + "proofofplay_apex_transactions", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_transactions_from_address"), + "proofofplay_apex_transactions", + ["from_address"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_transactions_gas"), + "proofofplay_apex_transactions", + ["gas"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_transactions_gas_price"), + "proofofplay_apex_transactions", + ["gas_price"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_transactions_hash"), + "proofofplay_apex_transactions", + ["hash"], + unique=True, + ) + op.create_index( + op.f("ix_proofofplay_apex_transactions_to_address"), + "proofofplay_apex_transactions", + ["to_address"], + unique=False, + ) + op.create_index( + op.f("ix_proofofplay_apex_transactions_value"), + "proofofplay_apex_transactions", + ["value"], + unique=False, + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index( + op.f("ix_proofofplay_apex_transactions_value"), + table_name="proofofplay_apex_transactions", + ) + op.drop_index( + op.f("ix_proofofplay_apex_transactions_to_address"), + table_name="proofofplay_apex_transactions", + ) + op.drop_index( + op.f("ix_proofofplay_apex_transactions_hash"), + table_name="proofofplay_apex_transactions", + ) + op.drop_index( + op.f("ix_proofofplay_apex_transactions_gas_price"), + table_name="proofofplay_apex_transactions", + ) + op.drop_index( + op.f("ix_proofofplay_apex_transactions_gas"), + table_name="proofofplay_apex_transactions", + ) + op.drop_index( + op.f("ix_proofofplay_apex_transactions_from_address"), + table_name="proofofplay_apex_transactions", + ) + op.drop_index( + op.f("ix_proofofplay_apex_transactions_block_number"), + table_name="proofofplay_apex_transactions", + ) + op.drop_table("proofofplay_apex_transactions") + op.drop_index( + op.f("ix_proofofplay_apex_labels_transaction_hash"), + table_name="proofofplay_apex_labels", + ) + op.drop_index( + op.f("ix_proofofplay_apex_labels_label"), table_name="proofofplay_apex_labels" + ) + op.drop_index( + op.f("ix_proofofplay_apex_labels_block_timestamp"), + table_name="proofofplay_apex_labels", + ) + op.drop_index( + op.f("ix_proofofplay_apex_labels_block_number"), + table_name="proofofplay_apex_labels", + ) + op.drop_index( + "ix_proofofplay_apex_labels_address_block_timestamp", + table_name="proofofplay_apex_labels", + ) + op.drop_index( + "ix_proofofplay_apex_labels_address_block_number", + table_name="proofofplay_apex_labels", + ) + op.drop_index( + op.f("ix_proofofplay_apex_labels_address"), table_name="proofofplay_apex_labels" + ) + op.drop_table("proofofplay_apex_labels") + op.drop_index( + op.f("ix_proofofplay_apex_blocks_timestamp"), + table_name="proofofplay_apex_blocks", + ) + op.drop_index( + op.f("ix_proofofplay_apex_blocks_hash"), table_name="proofofplay_apex_blocks" + ) + op.drop_index( + op.f("ix_proofofplay_apex_blocks_block_number"), + table_name="proofofplay_apex_blocks", + ) + op.drop_table("proofofplay_apex_blocks") + # ### end Alembic commands ### diff --git a/moonstreamdb/alembic/versions/a95cbab56a0b_avalanche_and_zksync_era_sepolia_.py b/moonstreamdb/alembic/versions/a95cbab56a0b_avalanche_and_zksync_era_sepolia_.py index 961c35c9..68c16edb 100644 --- a/moonstreamdb/alembic/versions/a95cbab56a0b_avalanche_and_zksync_era_sepolia_.py +++ b/moonstreamdb/alembic/versions/a95cbab56a0b_avalanche_and_zksync_era_sepolia_.py @@ -5,327 +5,836 @@ Revises: a99b97acc39e Create Date: 2024-03-28 11:08:06.677075 """ + from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. -revision = 'a95cbab56a0b' -down_revision = 'a99b97acc39e' +revision = "a95cbab56a0b" +down_revision = "a99b97acc39e" branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.create_table('avalanche_blocks', - sa.Column('block_number', sa.BigInteger(), nullable=False), - sa.Column('difficulty', sa.BigInteger(), nullable=True), - sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True), - sa.Column('gas_limit', sa.BigInteger(), nullable=True), - sa.Column('gas_used', sa.BigInteger(), nullable=True), - sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True), - sa.Column('miner', sa.VARCHAR(length=256), nullable=True), - sa.Column('nonce', sa.VARCHAR(length=256), nullable=True), - sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('uncles', sa.VARCHAR(length=256), nullable=True), - sa.Column('size', sa.Integer(), nullable=True), - sa.Column('state_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('timestamp', sa.BigInteger(), nullable=True), - sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True), - sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('block_extra_data', sa.VARCHAR(length=256), nullable=True), - sa.Column('block_gas_cost', sa.VARCHAR(length=256), nullable=True), - sa.Column('ext_data_gas_used', sa.VARCHAR(length=256), nullable=True), - sa.Column('ext_data_hash', sa.VARCHAR(length=256), nullable=True), - sa.PrimaryKeyConstraint('block_number', name=op.f('pk_avalanche_blocks')) + op.create_table( + "avalanche_blocks", + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("difficulty", sa.BigInteger(), nullable=True), + sa.Column("extra_data", sa.VARCHAR(length=128), nullable=True), + sa.Column("gas_limit", sa.BigInteger(), nullable=True), + sa.Column("gas_used", sa.BigInteger(), nullable=True), + sa.Column("base_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("logs_bloom", sa.VARCHAR(length=1024), nullable=True), + sa.Column("miner", sa.VARCHAR(length=256), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("parent_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("receipt_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("uncles", sa.VARCHAR(length=256), nullable=True), + sa.Column("size", sa.Integer(), nullable=True), + sa.Column("state_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("timestamp", sa.BigInteger(), nullable=True), + sa.Column("total_difficulty", sa.VARCHAR(length=256), nullable=True), + sa.Column("transactions_root", sa.VARCHAR(length=256), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.Column("mix_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("block_extra_data", sa.VARCHAR(length=256), nullable=True), + sa.Column("block_gas_cost", sa.VARCHAR(length=256), nullable=True), + sa.Column("ext_data_gas_used", sa.VARCHAR(length=256), nullable=True), + sa.Column("ext_data_hash", sa.VARCHAR(length=256), nullable=True), + sa.PrimaryKeyConstraint("block_number", name=op.f("pk_avalanche_blocks")), ) - op.create_index(op.f('ix_avalanche_blocks_block_number'), 'avalanche_blocks', ['block_number'], unique=True) - op.create_index(op.f('ix_avalanche_blocks_hash'), 'avalanche_blocks', ['hash'], unique=False) - op.create_index(op.f('ix_avalanche_blocks_timestamp'), 'avalanche_blocks', ['timestamp'], unique=False) - op.create_table('avalanche_fuji_blocks', - sa.Column('block_number', sa.BigInteger(), nullable=False), - sa.Column('difficulty', sa.BigInteger(), nullable=True), - sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True), - sa.Column('gas_limit', sa.BigInteger(), nullable=True), - sa.Column('gas_used', sa.BigInteger(), nullable=True), - sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True), - sa.Column('miner', sa.VARCHAR(length=256), nullable=True), - sa.Column('nonce', sa.VARCHAR(length=256), nullable=True), - sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('uncles', sa.VARCHAR(length=256), nullable=True), - sa.Column('size', sa.Integer(), nullable=True), - sa.Column('state_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('timestamp', sa.BigInteger(), nullable=True), - sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True), - sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('block_extra_data', sa.VARCHAR(length=256), nullable=True), - sa.Column('block_gas_cost', sa.VARCHAR(length=256), nullable=True), - sa.Column('ext_data_gas_used', sa.VARCHAR(length=256), nullable=True), - sa.Column('ext_data_hash', sa.VARCHAR(length=256), nullable=True), - sa.PrimaryKeyConstraint('block_number', name=op.f('pk_avalanche_fuji_blocks')) + op.create_index( + op.f("ix_avalanche_blocks_block_number"), + "avalanche_blocks", + ["block_number"], + unique=True, ) - op.create_index(op.f('ix_avalanche_fuji_blocks_block_number'), 'avalanche_fuji_blocks', ['block_number'], unique=True) - op.create_index(op.f('ix_avalanche_fuji_blocks_hash'), 'avalanche_fuji_blocks', ['hash'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_blocks_timestamp'), 'avalanche_fuji_blocks', ['timestamp'], unique=False) - op.create_table('avalanche_fuji_labels', - sa.Column('id', sa.UUID(), nullable=False), - sa.Column('label', sa.VARCHAR(length=256), nullable=False), - sa.Column('block_number', sa.BigInteger(), nullable=True), - sa.Column('address', sa.VARCHAR(length=256), nullable=True), - sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True), - sa.Column('block_timestamp', sa.BigInteger(), nullable=True), - sa.Column('log_index', sa.Integer(), nullable=True), - sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_avalanche_fuji_labels')), - sa.UniqueConstraint('id', name=op.f('uq_avalanche_fuji_labels_id')) + op.create_index( + op.f("ix_avalanche_blocks_hash"), "avalanche_blocks", ["hash"], unique=False ) - op.create_index(op.f('ix_avalanche_fuji_labels_address'), 'avalanche_fuji_labels', ['address'], unique=False) - op.create_index('ix_avalanche_fuji_labels_address_block_number', 'avalanche_fuji_labels', ['address', 'block_number'], unique=False) - op.create_index('ix_avalanche_fuji_labels_address_block_timestamp', 'avalanche_fuji_labels', ['address', 'block_timestamp'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_labels_block_number'), 'avalanche_fuji_labels', ['block_number'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_labels_block_timestamp'), 'avalanche_fuji_labels', ['block_timestamp'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_labels_label'), 'avalanche_fuji_labels', ['label'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_labels_transaction_hash'), 'avalanche_fuji_labels', ['transaction_hash'], unique=False) - op.create_table('avalanche_labels', - sa.Column('id', sa.UUID(), nullable=False), - sa.Column('label', sa.VARCHAR(length=256), nullable=False), - sa.Column('block_number', sa.BigInteger(), nullable=True), - sa.Column('address', sa.VARCHAR(length=256), nullable=True), - sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True), - sa.Column('block_timestamp', sa.BigInteger(), nullable=True), - sa.Column('log_index', sa.Integer(), nullable=True), - sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_avalanche_labels')), - sa.UniqueConstraint('id', name=op.f('uq_avalanche_labels_id')) + op.create_index( + op.f("ix_avalanche_blocks_timestamp"), + "avalanche_blocks", + ["timestamp"], + unique=False, ) - op.create_index(op.f('ix_avalanche_labels_address'), 'avalanche_labels', ['address'], unique=False) - op.create_index('ix_avalanche_labels_address_block_number', 'avalanche_labels', ['address', 'block_number'], unique=False) - op.create_index('ix_avalanche_labels_address_block_timestamp', 'avalanche_labels', ['address', 'block_timestamp'], unique=False) - op.create_index(op.f('ix_avalanche_labels_block_number'), 'avalanche_labels', ['block_number'], unique=False) - op.create_index(op.f('ix_avalanche_labels_block_timestamp'), 'avalanche_labels', ['block_timestamp'], unique=False) - op.create_index(op.f('ix_avalanche_labels_label'), 'avalanche_labels', ['label'], unique=False) - op.create_index(op.f('ix_avalanche_labels_transaction_hash'), 'avalanche_labels', ['transaction_hash'], unique=False) - op.create_table('zksync_era_sepolia_blocks', - sa.Column('block_number', sa.BigInteger(), nullable=False), - sa.Column('difficulty', sa.BigInteger(), nullable=True), - sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True), - sa.Column('gas_limit', sa.BigInteger(), nullable=True), - sa.Column('gas_used', sa.BigInteger(), nullable=True), - sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True), - sa.Column('miner', sa.VARCHAR(length=256), nullable=True), - sa.Column('nonce', sa.VARCHAR(length=256), nullable=True), - sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('uncles', sa.VARCHAR(length=256), nullable=True), - sa.Column('size', sa.Integer(), nullable=True), - sa.Column('state_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('timestamp', sa.BigInteger(), nullable=True), - sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True), - sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True), - sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('sha3_uncles', sa.VARCHAR(length=256), nullable=True), - sa.Column('l1_batch_number', sa.BigInteger(), nullable=True), - sa.Column('l1_batch_timestamp', sa.BigInteger(), nullable=True), - sa.PrimaryKeyConstraint('block_number', name=op.f('pk_zksync_era_sepolia_blocks')) + op.create_table( + "avalanche_fuji_blocks", + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("difficulty", sa.BigInteger(), nullable=True), + sa.Column("extra_data", sa.VARCHAR(length=128), nullable=True), + sa.Column("gas_limit", sa.BigInteger(), nullable=True), + sa.Column("gas_used", sa.BigInteger(), nullable=True), + sa.Column("base_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("logs_bloom", sa.VARCHAR(length=1024), nullable=True), + sa.Column("miner", sa.VARCHAR(length=256), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("parent_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("receipt_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("uncles", sa.VARCHAR(length=256), nullable=True), + sa.Column("size", sa.Integer(), nullable=True), + sa.Column("state_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("timestamp", sa.BigInteger(), nullable=True), + sa.Column("total_difficulty", sa.VARCHAR(length=256), nullable=True), + sa.Column("transactions_root", sa.VARCHAR(length=256), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.Column("mix_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("block_extra_data", sa.VARCHAR(length=256), nullable=True), + sa.Column("block_gas_cost", sa.VARCHAR(length=256), nullable=True), + sa.Column("ext_data_gas_used", sa.VARCHAR(length=256), nullable=True), + sa.Column("ext_data_hash", sa.VARCHAR(length=256), nullable=True), + sa.PrimaryKeyConstraint("block_number", name=op.f("pk_avalanche_fuji_blocks")), ) - op.create_index(op.f('ix_zksync_era_sepolia_blocks_block_number'), 'zksync_era_sepolia_blocks', ['block_number'], unique=True) - op.create_index(op.f('ix_zksync_era_sepolia_blocks_hash'), 'zksync_era_sepolia_blocks', ['hash'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_blocks_timestamp'), 'zksync_era_sepolia_blocks', ['timestamp'], unique=False) - op.create_table('zksync_era_sepolia_labels', - sa.Column('id', sa.UUID(), nullable=False), - sa.Column('label', sa.VARCHAR(length=256), nullable=False), - sa.Column('block_number', sa.BigInteger(), nullable=True), - sa.Column('address', sa.VARCHAR(length=256), nullable=True), - sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True), - sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True), - sa.Column('block_timestamp', sa.BigInteger(), nullable=True), - sa.Column('log_index', sa.Integer(), nullable=True), - sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.PrimaryKeyConstraint('id', name=op.f('pk_zksync_era_sepolia_labels')), - sa.UniqueConstraint('id', name=op.f('uq_zksync_era_sepolia_labels_id')) + op.create_index( + op.f("ix_avalanche_fuji_blocks_block_number"), + "avalanche_fuji_blocks", + ["block_number"], + unique=True, ) - op.create_index(op.f('ix_zksync_era_sepolia_labels_address'), 'zksync_era_sepolia_labels', ['address'], unique=False) - op.create_index('ix_zksync_era_sepolia_labels_address_block_number', 'zksync_era_sepolia_labels', ['address', 'block_number'], unique=False) - op.create_index('ix_zksync_era_sepolia_labels_address_block_timestamp', 'zksync_era_sepolia_labels', ['address', 'block_timestamp'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_labels_block_number'), 'zksync_era_sepolia_labels', ['block_number'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_labels_block_timestamp'), 'zksync_era_sepolia_labels', ['block_timestamp'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_labels_label'), 'zksync_era_sepolia_labels', ['label'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_labels_transaction_hash'), 'zksync_era_sepolia_labels', ['transaction_hash'], unique=False) - op.create_table('avalanche_fuji_transactions', - sa.Column('hash', sa.VARCHAR(length=256), nullable=False), - sa.Column('block_number', sa.BigInteger(), nullable=False), - sa.Column('from_address', sa.VARCHAR(length=256), nullable=True), - sa.Column('to_address', sa.VARCHAR(length=256), nullable=True), - sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('input', sa.Text(), nullable=True), - sa.Column('nonce', sa.VARCHAR(length=256), nullable=True), - sa.Column('transaction_index', sa.BigInteger(), nullable=True), - sa.Column('transaction_type', sa.Integer(), nullable=True), - sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.ForeignKeyConstraint(['block_number'], ['avalanche_fuji_blocks.block_number'], name=op.f('fk_avalanche_fuji_transactions_block_number_avalanche_fuji_blocks'), ondelete='CASCADE'), - sa.PrimaryKeyConstraint('hash', name=op.f('pk_avalanche_fuji_transactions')) + op.create_index( + op.f("ix_avalanche_fuji_blocks_hash"), + "avalanche_fuji_blocks", + ["hash"], + unique=False, ) - op.create_index(op.f('ix_avalanche_fuji_transactions_block_number'), 'avalanche_fuji_transactions', ['block_number'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_transactions_from_address'), 'avalanche_fuji_transactions', ['from_address'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_transactions_gas'), 'avalanche_fuji_transactions', ['gas'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_transactions_gas_price'), 'avalanche_fuji_transactions', ['gas_price'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_transactions_hash'), 'avalanche_fuji_transactions', ['hash'], unique=True) - op.create_index(op.f('ix_avalanche_fuji_transactions_to_address'), 'avalanche_fuji_transactions', ['to_address'], unique=False) - op.create_index(op.f('ix_avalanche_fuji_transactions_value'), 'avalanche_fuji_transactions', ['value'], unique=False) - op.create_table('avalanche_transactions', - sa.Column('hash', sa.VARCHAR(length=256), nullable=False), - sa.Column('block_number', sa.BigInteger(), nullable=False), - sa.Column('from_address', sa.VARCHAR(length=256), nullable=True), - sa.Column('to_address', sa.VARCHAR(length=256), nullable=True), - sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('input', sa.Text(), nullable=True), - sa.Column('nonce', sa.VARCHAR(length=256), nullable=True), - sa.Column('transaction_index', sa.BigInteger(), nullable=True), - sa.Column('transaction_type', sa.Integer(), nullable=True), - sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.ForeignKeyConstraint(['block_number'], ['avalanche_blocks.block_number'], name=op.f('fk_avalanche_transactions_block_number_avalanche_blocks'), ondelete='CASCADE'), - sa.PrimaryKeyConstraint('hash', name=op.f('pk_avalanche_transactions')) + op.create_index( + op.f("ix_avalanche_fuji_blocks_timestamp"), + "avalanche_fuji_blocks", + ["timestamp"], + unique=False, ) - op.create_index(op.f('ix_avalanche_transactions_block_number'), 'avalanche_transactions', ['block_number'], unique=False) - op.create_index(op.f('ix_avalanche_transactions_from_address'), 'avalanche_transactions', ['from_address'], unique=False) - op.create_index(op.f('ix_avalanche_transactions_gas'), 'avalanche_transactions', ['gas'], unique=False) - op.create_index(op.f('ix_avalanche_transactions_gas_price'), 'avalanche_transactions', ['gas_price'], unique=False) - op.create_index(op.f('ix_avalanche_transactions_hash'), 'avalanche_transactions', ['hash'], unique=True) - op.create_index(op.f('ix_avalanche_transactions_to_address'), 'avalanche_transactions', ['to_address'], unique=False) - op.create_index(op.f('ix_avalanche_transactions_value'), 'avalanche_transactions', ['value'], unique=False) - op.create_table('zksync_era_sepolia_transactions', - sa.Column('hash', sa.VARCHAR(length=256), nullable=False), - sa.Column('block_number', sa.BigInteger(), nullable=False), - sa.Column('from_address', sa.VARCHAR(length=256), nullable=True), - sa.Column('to_address', sa.VARCHAR(length=256), nullable=True), - sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('input', sa.Text(), nullable=True), - sa.Column('nonce', sa.VARCHAR(length=256), nullable=True), - sa.Column('transaction_index', sa.BigInteger(), nullable=True), - sa.Column('transaction_type', sa.Integer(), nullable=True), - sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True), - sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False), - sa.Column('l1_batch_number', sa.BigInteger(), nullable=True), - sa.Column('l1_batch_tx_index', sa.BigInteger(), nullable=True), - sa.ForeignKeyConstraint(['block_number'], ['zksync_era_sepolia_blocks.block_number'], name=op.f('fk_zksync_era_sepolia_transactions_block_number_zksync_era_sepolia_blocks'), ondelete='CASCADE'), - sa.PrimaryKeyConstraint('hash', name=op.f('pk_zksync_era_sepolia_transactions')) + op.create_table( + "avalanche_fuji_labels", + sa.Column("id", sa.UUID(), nullable=False), + sa.Column("label", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=True), + sa.Column("address", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("label_data", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column("block_timestamp", sa.BigInteger(), nullable=True), + sa.Column("log_index", sa.Integer(), nullable=True), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.PrimaryKeyConstraint("id", name=op.f("pk_avalanche_fuji_labels")), + sa.UniqueConstraint("id", name=op.f("uq_avalanche_fuji_labels_id")), + ) + op.create_index( + op.f("ix_avalanche_fuji_labels_address"), + "avalanche_fuji_labels", + ["address"], + unique=False, + ) + op.create_index( + "ix_avalanche_fuji_labels_address_block_number", + "avalanche_fuji_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_avalanche_fuji_labels_address_block_timestamp", + "avalanche_fuji_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_labels_block_number"), + "avalanche_fuji_labels", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_labels_block_timestamp"), + "avalanche_fuji_labels", + ["block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_labels_label"), + "avalanche_fuji_labels", + ["label"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_labels_transaction_hash"), + "avalanche_fuji_labels", + ["transaction_hash"], + unique=False, + ) + op.create_table( + "avalanche_labels", + sa.Column("id", sa.UUID(), nullable=False), + sa.Column("label", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=True), + sa.Column("address", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("label_data", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column("block_timestamp", sa.BigInteger(), nullable=True), + sa.Column("log_index", sa.Integer(), nullable=True), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.PrimaryKeyConstraint("id", name=op.f("pk_avalanche_labels")), + sa.UniqueConstraint("id", name=op.f("uq_avalanche_labels_id")), + ) + op.create_index( + op.f("ix_avalanche_labels_address"), + "avalanche_labels", + ["address"], + unique=False, + ) + op.create_index( + "ix_avalanche_labels_address_block_number", + "avalanche_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_avalanche_labels_address_block_timestamp", + "avalanche_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_labels_block_number"), + "avalanche_labels", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_labels_block_timestamp"), + "avalanche_labels", + ["block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_labels_label"), "avalanche_labels", ["label"], unique=False + ) + op.create_index( + op.f("ix_avalanche_labels_transaction_hash"), + "avalanche_labels", + ["transaction_hash"], + unique=False, + ) + op.create_table( + "zksync_era_sepolia_blocks", + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("difficulty", sa.BigInteger(), nullable=True), + sa.Column("extra_data", sa.VARCHAR(length=128), nullable=True), + sa.Column("gas_limit", sa.BigInteger(), nullable=True), + sa.Column("gas_used", sa.BigInteger(), nullable=True), + sa.Column("base_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("logs_bloom", sa.VARCHAR(length=1024), nullable=True), + sa.Column("miner", sa.VARCHAR(length=256), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("parent_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("receipt_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("uncles", sa.VARCHAR(length=256), nullable=True), + sa.Column("size", sa.Integer(), nullable=True), + sa.Column("state_root", sa.VARCHAR(length=256), nullable=True), + sa.Column("timestamp", sa.BigInteger(), nullable=True), + sa.Column("total_difficulty", sa.VARCHAR(length=256), nullable=True), + sa.Column("transactions_root", sa.VARCHAR(length=256), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.Column("mix_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("sha3_uncles", sa.VARCHAR(length=256), nullable=True), + sa.Column("l1_batch_number", sa.BigInteger(), nullable=True), + sa.Column("l1_batch_timestamp", sa.BigInteger(), nullable=True), + sa.PrimaryKeyConstraint( + "block_number", name=op.f("pk_zksync_era_sepolia_blocks") + ), + ) + op.create_index( + op.f("ix_zksync_era_sepolia_blocks_block_number"), + "zksync_era_sepolia_blocks", + ["block_number"], + unique=True, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_blocks_hash"), + "zksync_era_sepolia_blocks", + ["hash"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_blocks_timestamp"), + "zksync_era_sepolia_blocks", + ["timestamp"], + unique=False, + ) + op.create_table( + "zksync_era_sepolia_labels", + sa.Column("id", sa.UUID(), nullable=False), + sa.Column("label", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=True), + sa.Column("address", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=True), + sa.Column("label_data", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column("block_timestamp", sa.BigInteger(), nullable=True), + sa.Column("log_index", sa.Integer(), nullable=True), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.PrimaryKeyConstraint("id", name=op.f("pk_zksync_era_sepolia_labels")), + sa.UniqueConstraint("id", name=op.f("uq_zksync_era_sepolia_labels_id")), + ) + op.create_index( + op.f("ix_zksync_era_sepolia_labels_address"), + "zksync_era_sepolia_labels", + ["address"], + unique=False, + ) + op.create_index( + "ix_zksync_era_sepolia_labels_address_block_number", + "zksync_era_sepolia_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_zksync_era_sepolia_labels_address_block_timestamp", + "zksync_era_sepolia_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_labels_block_number"), + "zksync_era_sepolia_labels", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_labels_block_timestamp"), + "zksync_era_sepolia_labels", + ["block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_labels_label"), + "zksync_era_sepolia_labels", + ["label"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_labels_transaction_hash"), + "zksync_era_sepolia_labels", + ["transaction_hash"], + unique=False, + ) + op.create_table( + "avalanche_fuji_transactions", + sa.Column("hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("from_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("to_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("gas_price", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("max_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "max_priority_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True + ), + sa.Column("input", sa.Text(), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_index", sa.BigInteger(), nullable=True), + sa.Column("transaction_type", sa.Integer(), nullable=True), + sa.Column("value", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.ForeignKeyConstraint( + ["block_number"], + ["avalanche_fuji_blocks.block_number"], + name=op.f( + "fk_avalanche_fuji_transactions_block_number_avalanche_fuji_blocks" + ), + ondelete="CASCADE", + ), + sa.PrimaryKeyConstraint("hash", name=op.f("pk_avalanche_fuji_transactions")), + ) + op.create_index( + op.f("ix_avalanche_fuji_transactions_block_number"), + "avalanche_fuji_transactions", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_transactions_from_address"), + "avalanche_fuji_transactions", + ["from_address"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_transactions_gas"), + "avalanche_fuji_transactions", + ["gas"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_transactions_gas_price"), + "avalanche_fuji_transactions", + ["gas_price"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_transactions_hash"), + "avalanche_fuji_transactions", + ["hash"], + unique=True, + ) + op.create_index( + op.f("ix_avalanche_fuji_transactions_to_address"), + "avalanche_fuji_transactions", + ["to_address"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_fuji_transactions_value"), + "avalanche_fuji_transactions", + ["value"], + unique=False, + ) + op.create_table( + "avalanche_transactions", + sa.Column("hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("from_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("to_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("gas_price", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("max_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "max_priority_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True + ), + sa.Column("input", sa.Text(), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_index", sa.BigInteger(), nullable=True), + sa.Column("transaction_type", sa.Integer(), nullable=True), + sa.Column("value", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.ForeignKeyConstraint( + ["block_number"], + ["avalanche_blocks.block_number"], + name=op.f("fk_avalanche_transactions_block_number_avalanche_blocks"), + ondelete="CASCADE", + ), + sa.PrimaryKeyConstraint("hash", name=op.f("pk_avalanche_transactions")), + ) + op.create_index( + op.f("ix_avalanche_transactions_block_number"), + "avalanche_transactions", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_transactions_from_address"), + "avalanche_transactions", + ["from_address"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_transactions_gas"), + "avalanche_transactions", + ["gas"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_transactions_gas_price"), + "avalanche_transactions", + ["gas_price"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_transactions_hash"), + "avalanche_transactions", + ["hash"], + unique=True, + ) + op.create_index( + op.f("ix_avalanche_transactions_to_address"), + "avalanche_transactions", + ["to_address"], + unique=False, + ) + op.create_index( + op.f("ix_avalanche_transactions_value"), + "avalanche_transactions", + ["value"], + unique=False, + ) + op.create_table( + "zksync_era_sepolia_transactions", + sa.Column("hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("block_number", sa.BigInteger(), nullable=False), + sa.Column("from_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("to_address", sa.VARCHAR(length=256), nullable=True), + sa.Column("gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("gas_price", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column("max_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "max_priority_fee_per_gas", sa.Numeric(precision=78, scale=0), nullable=True + ), + sa.Column("input", sa.Text(), nullable=True), + sa.Column("nonce", sa.VARCHAR(length=256), nullable=True), + sa.Column("transaction_index", sa.BigInteger(), nullable=True), + sa.Column("transaction_type", sa.Integer(), nullable=True), + sa.Column("value", sa.Numeric(precision=78, scale=0), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.Column("l1_batch_number", sa.BigInteger(), nullable=True), + sa.Column("l1_batch_tx_index", sa.BigInteger(), nullable=True), + sa.ForeignKeyConstraint( + ["block_number"], + ["zksync_era_sepolia_blocks.block_number"], + name=op.f( + "fk_zksync_era_sepolia_transactions_block_number_zksync_era_sepolia_blocks" + ), + ondelete="CASCADE", + ), + sa.PrimaryKeyConstraint( + "hash", name=op.f("pk_zksync_era_sepolia_transactions") + ), + ) + op.create_index( + op.f("ix_zksync_era_sepolia_transactions_block_number"), + "zksync_era_sepolia_transactions", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_transactions_from_address"), + "zksync_era_sepolia_transactions", + ["from_address"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_transactions_gas"), + "zksync_era_sepolia_transactions", + ["gas"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_transactions_gas_price"), + "zksync_era_sepolia_transactions", + ["gas_price"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_transactions_hash"), + "zksync_era_sepolia_transactions", + ["hash"], + unique=True, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_transactions_to_address"), + "zksync_era_sepolia_transactions", + ["to_address"], + unique=False, + ) + op.create_index( + op.f("ix_zksync_era_sepolia_transactions_value"), + "zksync_era_sepolia_transactions", + ["value"], + unique=False, + ) + op.create_index( + "ix_arbitrum_nova_labels_address_block_number", + "arbitrum_nova_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_arbitrum_nova_labels_address_block_timestamp", + "arbitrum_nova_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_index( + "ix_arbitrum_sepolia_labels_address_block_number", + "arbitrum_sepolia_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_arbitrum_sepolia_labels_address_block_timestamp", + "arbitrum_sepolia_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_unique_constraint( + op.f("uq_arbitrum_sepolia_labels_id"), "arbitrum_sepolia_labels", ["id"] ) - op.create_index(op.f('ix_zksync_era_sepolia_transactions_block_number'), 'zksync_era_sepolia_transactions', ['block_number'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_transactions_from_address'), 'zksync_era_sepolia_transactions', ['from_address'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_transactions_gas'), 'zksync_era_sepolia_transactions', ['gas'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_transactions_gas_price'), 'zksync_era_sepolia_transactions', ['gas_price'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_transactions_hash'), 'zksync_era_sepolia_transactions', ['hash'], unique=True) - op.create_index(op.f('ix_zksync_era_sepolia_transactions_to_address'), 'zksync_era_sepolia_transactions', ['to_address'], unique=False) - op.create_index(op.f('ix_zksync_era_sepolia_transactions_value'), 'zksync_era_sepolia_transactions', ['value'], unique=False) - op.create_index('ix_arbitrum_nova_labels_address_block_number', 'arbitrum_nova_labels', ['address', 'block_number'], unique=False) - op.create_index('ix_arbitrum_nova_labels_address_block_timestamp', 'arbitrum_nova_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('ix_arbitrum_sepolia_labels_address_block_number', 'arbitrum_sepolia_labels', ['address', 'block_number'], unique=False) - op.create_index('ix_arbitrum_sepolia_labels_address_block_timestamp', 'arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False) - op.create_unique_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', ['id']) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint(op.f('uq_zksync_era_testnet_labels_id'), 'zksync_era_testnet_labels', type_='unique') - op.drop_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', type_='unique') - op.drop_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', type_='unique') - op.drop_constraint(op.f('uq_xai_labels_id'), 'xai_labels', type_='unique') - op.drop_constraint(op.f('uq_wyrm_labels_id'), 'wyrm_labels', type_='unique') - op.drop_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', type_='unique') - op.drop_constraint(op.f('uq_opensea_crawler_state_id'), 'opensea_crawler_state', type_='unique') - op.drop_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', type_='unique') - op.create_index('idx_ethereum_labels_opensea_nft_name', 'ethereum_labels', [sa.text("(label_data ->> 'name'::text)")], unique=False) - op.drop_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', type_='unique') - op.drop_index('ix_arbitrum_sepolia_labels_address_block_timestamp', table_name='arbitrum_sepolia_labels') - op.drop_index('ix_arbitrum_sepolia_labels_address_block_number', table_name='arbitrum_sepolia_labels') - op.drop_index('ix_arbitrum_nova_labels_address_block_timestamp', table_name='arbitrum_nova_labels') - op.drop_index('ix_arbitrum_nova_labels_address_block_number', table_name='arbitrum_nova_labels') - op.drop_index(op.f('ix_zksync_era_sepolia_transactions_value'), table_name='zksync_era_sepolia_transactions') - op.drop_index(op.f('ix_zksync_era_sepolia_transactions_to_address'), table_name='zksync_era_sepolia_transactions') - op.drop_index(op.f('ix_zksync_era_sepolia_transactions_hash'), table_name='zksync_era_sepolia_transactions') - op.drop_index(op.f('ix_zksync_era_sepolia_transactions_gas_price'), table_name='zksync_era_sepolia_transactions') - op.drop_index(op.f('ix_zksync_era_sepolia_transactions_gas'), table_name='zksync_era_sepolia_transactions') - op.drop_index(op.f('ix_zksync_era_sepolia_transactions_from_address'), table_name='zksync_era_sepolia_transactions') - op.drop_index(op.f('ix_zksync_era_sepolia_transactions_block_number'), table_name='zksync_era_sepolia_transactions') - op.drop_table('zksync_era_sepolia_transactions') - op.drop_index(op.f('ix_avalanche_transactions_value'), table_name='avalanche_transactions') - op.drop_index(op.f('ix_avalanche_transactions_to_address'), table_name='avalanche_transactions') - op.drop_index(op.f('ix_avalanche_transactions_hash'), table_name='avalanche_transactions') - op.drop_index(op.f('ix_avalanche_transactions_gas_price'), table_name='avalanche_transactions') - op.drop_index(op.f('ix_avalanche_transactions_gas'), table_name='avalanche_transactions') - op.drop_index(op.f('ix_avalanche_transactions_from_address'), table_name='avalanche_transactions') - op.drop_index(op.f('ix_avalanche_transactions_block_number'), table_name='avalanche_transactions') - op.drop_table('avalanche_transactions') - op.drop_index(op.f('ix_avalanche_fuji_transactions_value'), table_name='avalanche_fuji_transactions') - op.drop_index(op.f('ix_avalanche_fuji_transactions_to_address'), table_name='avalanche_fuji_transactions') - op.drop_index(op.f('ix_avalanche_fuji_transactions_hash'), table_name='avalanche_fuji_transactions') - op.drop_index(op.f('ix_avalanche_fuji_transactions_gas_price'), table_name='avalanche_fuji_transactions') - op.drop_index(op.f('ix_avalanche_fuji_transactions_gas'), table_name='avalanche_fuji_transactions') - op.drop_index(op.f('ix_avalanche_fuji_transactions_from_address'), table_name='avalanche_fuji_transactions') - op.drop_index(op.f('ix_avalanche_fuji_transactions_block_number'), table_name='avalanche_fuji_transactions') - op.drop_table('avalanche_fuji_transactions') - op.drop_index(op.f('ix_zksync_era_sepolia_labels_transaction_hash'), table_name='zksync_era_sepolia_labels') - op.drop_index(op.f('ix_zksync_era_sepolia_labels_label'), table_name='zksync_era_sepolia_labels') - op.drop_index(op.f('ix_zksync_era_sepolia_labels_block_timestamp'), table_name='zksync_era_sepolia_labels') - op.drop_index(op.f('ix_zksync_era_sepolia_labels_block_number'), table_name='zksync_era_sepolia_labels') - op.drop_index('ix_zksync_era_sepolia_labels_address_block_timestamp', table_name='zksync_era_sepolia_labels') - op.drop_index('ix_zksync_era_sepolia_labels_address_block_number', table_name='zksync_era_sepolia_labels') - op.drop_index(op.f('ix_zksync_era_sepolia_labels_address'), table_name='zksync_era_sepolia_labels') - op.drop_table('zksync_era_sepolia_labels') - op.drop_index(op.f('ix_zksync_era_sepolia_blocks_timestamp'), table_name='zksync_era_sepolia_blocks') - op.drop_index(op.f('ix_zksync_era_sepolia_blocks_hash'), table_name='zksync_era_sepolia_blocks') - op.drop_index(op.f('ix_zksync_era_sepolia_blocks_block_number'), table_name='zksync_era_sepolia_blocks') - op.drop_table('zksync_era_sepolia_blocks') - op.drop_index(op.f('ix_avalanche_labels_transaction_hash'), table_name='avalanche_labels') - op.drop_index(op.f('ix_avalanche_labels_label'), table_name='avalanche_labels') - op.drop_index(op.f('ix_avalanche_labels_block_timestamp'), table_name='avalanche_labels') - op.drop_index(op.f('ix_avalanche_labels_block_number'), table_name='avalanche_labels') - op.drop_index('ix_avalanche_labels_address_block_timestamp', table_name='avalanche_labels') - op.drop_index('ix_avalanche_labels_address_block_number', table_name='avalanche_labels') - op.drop_index(op.f('ix_avalanche_labels_address'), table_name='avalanche_labels') - op.drop_table('avalanche_labels') - op.drop_index(op.f('ix_avalanche_fuji_labels_transaction_hash'), table_name='avalanche_fuji_labels') - op.drop_index(op.f('ix_avalanche_fuji_labels_label'), table_name='avalanche_fuji_labels') - op.drop_index(op.f('ix_avalanche_fuji_labels_block_timestamp'), table_name='avalanche_fuji_labels') - op.drop_index(op.f('ix_avalanche_fuji_labels_block_number'), table_name='avalanche_fuji_labels') - op.drop_index('ix_avalanche_fuji_labels_address_block_timestamp', table_name='avalanche_fuji_labels') - op.drop_index('ix_avalanche_fuji_labels_address_block_number', table_name='avalanche_fuji_labels') - op.drop_index(op.f('ix_avalanche_fuji_labels_address'), table_name='avalanche_fuji_labels') - op.drop_table('avalanche_fuji_labels') - op.drop_index(op.f('ix_avalanche_fuji_blocks_timestamp'), table_name='avalanche_fuji_blocks') - op.drop_index(op.f('ix_avalanche_fuji_blocks_hash'), table_name='avalanche_fuji_blocks') - op.drop_index(op.f('ix_avalanche_fuji_blocks_block_number'), table_name='avalanche_fuji_blocks') - op.drop_table('avalanche_fuji_blocks') - op.drop_index(op.f('ix_avalanche_blocks_timestamp'), table_name='avalanche_blocks') - op.drop_index(op.f('ix_avalanche_blocks_hash'), table_name='avalanche_blocks') - op.drop_index(op.f('ix_avalanche_blocks_block_number'), table_name='avalanche_blocks') - op.drop_table('avalanche_blocks') + op.drop_constraint( + op.f("uq_zksync_era_testnet_labels_id"), + "zksync_era_testnet_labels", + type_="unique", + ) + op.drop_constraint( + op.f("uq_zksync_era_labels_id"), "zksync_era_labels", type_="unique" + ) + op.drop_constraint(op.f("uq_xdai_labels_id"), "xdai_labels", type_="unique") + # op.drop_constraint(op.f('uq_xai_labels_id'), 'xai_labels', type_='unique') + op.drop_constraint(op.f("uq_wyrm_labels_id"), "wyrm_labels", type_="unique") + op.drop_constraint(op.f("uq_polygon_labels_id"), "polygon_labels", type_="unique") + op.drop_constraint( + op.f("uq_opensea_crawler_state_id"), "opensea_crawler_state", type_="unique" + ) + op.drop_constraint(op.f("uq_mumbai_labels_id"), "mumbai_labels", type_="unique") + op.create_index( + "idx_ethereum_labels_opensea_nft_name", + "ethereum_labels", + [sa.text("(label_data ->> 'name'::text)")], + unique=False, + ) + op.drop_constraint( + op.f("uq_arbitrum_sepolia_labels_id"), "arbitrum_sepolia_labels", type_="unique" + ) + op.drop_index( + "ix_arbitrum_sepolia_labels_address_block_timestamp", + table_name="arbitrum_sepolia_labels", + ) + op.drop_index( + "ix_arbitrum_sepolia_labels_address_block_number", + table_name="arbitrum_sepolia_labels", + ) + op.drop_index( + "ix_arbitrum_nova_labels_address_block_timestamp", + table_name="arbitrum_nova_labels", + ) + op.drop_index( + "ix_arbitrum_nova_labels_address_block_number", + table_name="arbitrum_nova_labels", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_transactions_value"), + table_name="zksync_era_sepolia_transactions", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_transactions_to_address"), + table_name="zksync_era_sepolia_transactions", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_transactions_hash"), + table_name="zksync_era_sepolia_transactions", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_transactions_gas_price"), + table_name="zksync_era_sepolia_transactions", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_transactions_gas"), + table_name="zksync_era_sepolia_transactions", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_transactions_from_address"), + table_name="zksync_era_sepolia_transactions", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_transactions_block_number"), + table_name="zksync_era_sepolia_transactions", + ) + op.drop_table("zksync_era_sepolia_transactions") + op.drop_index( + op.f("ix_avalanche_transactions_value"), table_name="avalanche_transactions" + ) + op.drop_index( + op.f("ix_avalanche_transactions_to_address"), + table_name="avalanche_transactions", + ) + op.drop_index( + op.f("ix_avalanche_transactions_hash"), table_name="avalanche_transactions" + ) + op.drop_index( + op.f("ix_avalanche_transactions_gas_price"), table_name="avalanche_transactions" + ) + op.drop_index( + op.f("ix_avalanche_transactions_gas"), table_name="avalanche_transactions" + ) + op.drop_index( + op.f("ix_avalanche_transactions_from_address"), + table_name="avalanche_transactions", + ) + op.drop_index( + op.f("ix_avalanche_transactions_block_number"), + table_name="avalanche_transactions", + ) + op.drop_table("avalanche_transactions") + op.drop_index( + op.f("ix_avalanche_fuji_transactions_value"), + table_name="avalanche_fuji_transactions", + ) + op.drop_index( + op.f("ix_avalanche_fuji_transactions_to_address"), + table_name="avalanche_fuji_transactions", + ) + op.drop_index( + op.f("ix_avalanche_fuji_transactions_hash"), + table_name="avalanche_fuji_transactions", + ) + op.drop_index( + op.f("ix_avalanche_fuji_transactions_gas_price"), + table_name="avalanche_fuji_transactions", + ) + op.drop_index( + op.f("ix_avalanche_fuji_transactions_gas"), + table_name="avalanche_fuji_transactions", + ) + op.drop_index( + op.f("ix_avalanche_fuji_transactions_from_address"), + table_name="avalanche_fuji_transactions", + ) + op.drop_index( + op.f("ix_avalanche_fuji_transactions_block_number"), + table_name="avalanche_fuji_transactions", + ) + op.drop_table("avalanche_fuji_transactions") + op.drop_index( + op.f("ix_zksync_era_sepolia_labels_transaction_hash"), + table_name="zksync_era_sepolia_labels", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_labels_label"), + table_name="zksync_era_sepolia_labels", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_labels_block_timestamp"), + table_name="zksync_era_sepolia_labels", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_labels_block_number"), + table_name="zksync_era_sepolia_labels", + ) + op.drop_index( + "ix_zksync_era_sepolia_labels_address_block_timestamp", + table_name="zksync_era_sepolia_labels", + ) + op.drop_index( + "ix_zksync_era_sepolia_labels_address_block_number", + table_name="zksync_era_sepolia_labels", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_labels_address"), + table_name="zksync_era_sepolia_labels", + ) + op.drop_table("zksync_era_sepolia_labels") + op.drop_index( + op.f("ix_zksync_era_sepolia_blocks_timestamp"), + table_name="zksync_era_sepolia_blocks", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_blocks_hash"), + table_name="zksync_era_sepolia_blocks", + ) + op.drop_index( + op.f("ix_zksync_era_sepolia_blocks_block_number"), + table_name="zksync_era_sepolia_blocks", + ) + op.drop_table("zksync_era_sepolia_blocks") + op.drop_index( + op.f("ix_avalanche_labels_transaction_hash"), table_name="avalanche_labels" + ) + op.drop_index(op.f("ix_avalanche_labels_label"), table_name="avalanche_labels") + op.drop_index( + op.f("ix_avalanche_labels_block_timestamp"), table_name="avalanche_labels" + ) + op.drop_index( + op.f("ix_avalanche_labels_block_number"), table_name="avalanche_labels" + ) + op.drop_index( + "ix_avalanche_labels_address_block_timestamp", table_name="avalanche_labels" + ) + op.drop_index( + "ix_avalanche_labels_address_block_number", table_name="avalanche_labels" + ) + op.drop_index(op.f("ix_avalanche_labels_address"), table_name="avalanche_labels") + op.drop_table("avalanche_labels") + op.drop_index( + op.f("ix_avalanche_fuji_labels_transaction_hash"), + table_name="avalanche_fuji_labels", + ) + op.drop_index( + op.f("ix_avalanche_fuji_labels_label"), table_name="avalanche_fuji_labels" + ) + op.drop_index( + op.f("ix_avalanche_fuji_labels_block_timestamp"), + table_name="avalanche_fuji_labels", + ) + op.drop_index( + op.f("ix_avalanche_fuji_labels_block_number"), + table_name="avalanche_fuji_labels", + ) + op.drop_index( + "ix_avalanche_fuji_labels_address_block_timestamp", + table_name="avalanche_fuji_labels", + ) + op.drop_index( + "ix_avalanche_fuji_labels_address_block_number", + table_name="avalanche_fuji_labels", + ) + op.drop_index( + op.f("ix_avalanche_fuji_labels_address"), table_name="avalanche_fuji_labels" + ) + op.drop_table("avalanche_fuji_labels") + op.drop_index( + op.f("ix_avalanche_fuji_blocks_timestamp"), table_name="avalanche_fuji_blocks" + ) + op.drop_index( + op.f("ix_avalanche_fuji_blocks_hash"), table_name="avalanche_fuji_blocks" + ) + op.drop_index( + op.f("ix_avalanche_fuji_blocks_block_number"), + table_name="avalanche_fuji_blocks", + ) + op.drop_table("avalanche_fuji_blocks") + op.drop_index(op.f("ix_avalanche_blocks_timestamp"), table_name="avalanche_blocks") + op.drop_index(op.f("ix_avalanche_blocks_hash"), table_name="avalanche_blocks") + op.drop_index( + op.f("ix_avalanche_blocks_block_number"), table_name="avalanche_blocks" + ) + op.drop_table("avalanche_blocks") # ### end Alembic commands ### diff --git a/moonstreamdb/moonstreamdb/blockchain.py b/moonstreamdb/moonstreamdb/blockchain.py index 376c8ef2..9bbfa1f0 100644 --- a/moonstreamdb/moonstreamdb/blockchain.py +++ b/moonstreamdb/moonstreamdb/blockchain.py @@ -32,6 +32,9 @@ from .models import ( PolygonBlock, PolygonLabel, PolygonTransaction, + ProofOfPlayApexBlock, + ProofOfPlayApexLabel, + ProofOfPlayApexTransaction, WyrmBlock, WyrmLabel, WyrmTransaction, @@ -74,6 +77,7 @@ class AvailableBlockchainType(Enum): AVALANCHE_FUJI = "avalanche_fuji" BLAST = "blast" BLAST_SEPOLIA = "blast_sepolia" + PROOFOFPLAY_APEX = "proofofplay_apex" def get_block_model( @@ -97,6 +101,7 @@ def get_block_model( AvalancheFujiBlock, BlastBlock, BlastSepoliaBlock, + ProofOfPlayApexBlock, ] ]: """ @@ -121,6 +126,7 @@ def get_block_model( AvalancheFujiBlock, BlastBlock, BlastSepoliaBlock, + ProofOfPlayApexBlock, ] ] if blockchain_type == AvailableBlockchainType.ETHEREUM: @@ -157,6 +163,8 @@ def get_block_model( block_model = BlastBlock elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA: block_model = BlastSepoliaBlock + elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: + block_model = ProofOfPlayApexBlock else: raise Exception("Unsupported blockchain type provided") @@ -184,6 +192,7 @@ def get_label_model( AvalancheFujiLabel, BlastLabel, BlastSepoliaLabel, + ProofOfPlayApexLabel, ] ]: """ @@ -208,6 +217,7 @@ def get_label_model( AvalancheFujiLabel, BlastLabel, BlastSepoliaLabel, + ProofOfPlayApexLabel, ] ] if blockchain_type == AvailableBlockchainType.ETHEREUM: @@ -244,6 +254,8 @@ def get_label_model( label_model = BlastLabel elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA: label_model = BlastSepoliaLabel + elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: + label_model = ProofOfPlayApexLabel else: raise Exception("Unsupported blockchain type provided") @@ -271,6 +283,7 @@ def get_transaction_model( AvalancheFujiTransaction, BlastTransaction, BlastSepoliaTransaction, + ProofOfPlayApexTransaction, ] ]: """ @@ -295,6 +308,7 @@ def get_transaction_model( AvalancheFujiTransaction, BlastTransaction, BlastSepoliaTransaction, + ProofOfPlayApexTransaction, ] ] if blockchain_type == AvailableBlockchainType.ETHEREUM: @@ -331,6 +345,8 @@ def get_transaction_model( transaction_model = BlastTransaction elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA: transaction_model = BlastSepoliaTransaction + elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: + transaction_model = ProofOfPlayApexTransaction else: raise Exception("Unsupported blockchain type provided") diff --git a/moonstreamdb/moonstreamdb/models.py b/moonstreamdb/moonstreamdb/models.py index fa6c1380..2426604e 100644 --- a/moonstreamdb/moonstreamdb/models.py +++ b/moonstreamdb/moonstreamdb/models.py @@ -1936,6 +1936,120 @@ class BlastSepoliaLabel(Base): # type: ignore ) +class ProofOfPlayApexBlock(Base): # type: ignore + __tablename__ = "proofofplay_apex_blocks" + + block_number = Column( + BigInteger, primary_key=True, unique=True, nullable=False, index=True + ) + difficulty = Column(BigInteger) + extra_data = Column(VARCHAR(128)) + gas_limit = Column(BigInteger) + gas_used = Column(BigInteger) + base_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True) + hash = Column(VARCHAR(256), index=True) + logs_bloom = Column(VARCHAR(1024)) + miner = Column(VARCHAR(256)) + nonce = Column(VARCHAR(256)) + parent_hash = Column(VARCHAR(256)) + receipt_root = Column(VARCHAR(256)) + uncles = Column(VARCHAR(256)) + size = Column(Integer) + state_root = Column(VARCHAR(256)) + timestamp = Column(BigInteger, index=True) + total_difficulty = Column(VARCHAR(256)) + transactions_root = Column(VARCHAR(256)) + indexed_at = Column( + DateTime(timezone=True), server_default=utcnow(), nullable=False + ) + + sha3_uncles = Column(VARCHAR(256), nullable=True) + l1_block_number = Column(BigInteger, nullable=True) + send_count = Column(BigInteger, nullable=True) + send_root = Column(VARCHAR(256), nullable=True) + mix_hash = Column(VARCHAR(256), nullable=True) + + +class ProofOfPlayApexTransaction(Base): # type: ignore + __tablename__ = "proofofplay_apex_transactions" + + hash = Column( + VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True + ) + block_number = Column( + BigInteger, + ForeignKey("proofofplay_apex_blocks.block_number", ondelete="CASCADE"), + nullable=False, + index=True, + ) + from_address = Column(VARCHAR(256), index=True) + to_address = Column(VARCHAR(256), index=True) + gas = Column(Numeric(precision=78, scale=0), index=True) + gas_price = Column(Numeric(precision=78, scale=0), index=True) + max_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True) + max_priority_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True) + input = Column(Text) + nonce = Column(VARCHAR(256)) + transaction_index = Column(BigInteger) + transaction_type = Column(Integer, nullable=True) + value = Column(Numeric(precision=78, scale=0), index=True) + + indexed_at = Column( + DateTime(timezone=True), server_default=utcnow(), nullable=False + ) + + y_parity = Column(BigInteger, nullable=True) + + +class ProofOfPlayApexLabel(Base): # type: ignore + __tablename__ = "proofofplay_apex_labels" + + __table_args__ = ( + Index( + "ix_proofofplay_apex_labels_address_block_number", + "address", + "block_number", + unique=False, + ), + Index( + "ix_proofofplay_apex_labels_address_block_timestamp", + "address", + "block_timestamp", + unique=False, + ), + ) + + id = Column( + UUID(as_uuid=True), + primary_key=True, + default=uuid.uuid4, + unique=True, + nullable=False, + ) + label = Column(VARCHAR(256), nullable=False, index=True) + block_number = Column( + BigInteger, + nullable=True, + index=True, + ) + address = Column( + VARCHAR(256), + nullable=True, + index=True, + ) + transaction_hash = Column( + VARCHAR(256), + nullable=True, + index=True, + ) + label_data = Column(JSONB, nullable=True) + block_timestamp = Column(BigInteger, index=True) + log_index = Column(Integer, nullable=True) + created_at = Column( + DateTime(timezone=True), server_default=utcnow(), nullable=False + ) + + class ESDFunctionSignature(Base): # type: ignore """ Function signature from blockchain (Ethereum/Polygon) Signature Database. diff --git a/moonstreamdb/moonstreamdb/networks.py b/moonstreamdb/moonstreamdb/networks.py index 5d665813..a7cfa2fa 100644 --- a/moonstreamdb/moonstreamdb/networks.py +++ b/moonstreamdb/moonstreamdb/networks.py @@ -34,6 +34,9 @@ from .models import ( PolygonBlock, PolygonLabel, PolygonTransaction, + ProofOfPlayApexBlock, + ProofOfPlayApexLabel, + ProofOfPlayApexTransaction, WyrmBlock, WyrmLabel, WyrmTransaction, @@ -76,6 +79,7 @@ class Network(Enum): avalanche_fuji = "avalanche_fuji" blast = "blast" blast_sepolia = "blast_sepolia" + proofofplay_apex = "proofofplay_apex" tx_raw_types = Union[ @@ -96,6 +100,7 @@ tx_raw_types = Union[ AvalancheFujiTransaction, BlastTransaction, BlastSepoliaTransaction, + ProofOfPlayApexTransaction, ] MODELS: Dict[Network, Dict[str, Base]] = { @@ -184,6 +189,11 @@ MODELS: Dict[Network, Dict[str, Base]] = { "labels": BlastSepoliaLabel, "transactions": BlastSepoliaTransaction, }, + Network.proofofplay_apex: { + "blocks": ProofOfPlayApexBlock, + "labels": ProofOfPlayApexLabel, + "transactions": ProofOfPlayApexTransaction, + }, } @@ -224,5 +234,7 @@ def blockchain_type_to_network_type( return Network.blast elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA: return Network.blast_sepolia + elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: + return Network.proofofplay_apex else: raise ValueError(f"Unknown blockchain type: {blockchain_type}") diff --git a/moonstreamdb/moonstreamdb/subscriptions.py b/moonstreamdb/moonstreamdb/subscriptions.py index 2ad58bfd..3b567249 100644 --- a/moonstreamdb/moonstreamdb/subscriptions.py +++ b/moonstreamdb/moonstreamdb/subscriptions.py @@ -21,6 +21,7 @@ class SubscriptionTypes(Enum): AVALANCHE_FUJI_BLOCKCHAIN = "avalanche_fuji_smartcontract" BLAST_BLOCKCHAIN = "blast_smartcontract" BLAST_SEPOLIA_BLOCKCHAIN = "blast_sepolia_smartcontract" + PROOFOFPLAY_APEX_BLOCKCHAIN = "proofofplay_apex_smartcontract" def blockchain_type_to_subscription_type( @@ -60,6 +61,8 @@ def blockchain_type_to_subscription_type( return SubscriptionTypes.BLAST_BLOCKCHAIN elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA: return SubscriptionTypes.BLAST_SEPOLIA_BLOCKCHAIN + elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: + return SubscriptionTypes.PROOFOFPLAY_APEX_BLOCKCHAIN else: raise ValueError(f"Unknown blockchain type: {blockchain_type}") @@ -82,6 +85,7 @@ subscription_id_by_blockchain = { "avalanche_fuji": "avalanche_fuji_smartcontract", "blast": "blast_smartcontract", "blast_sepolia": "blast_sepolia_smartcontract", + "proofofplay_apex": "proofofplay_apex_smartcontract", } blockchain_by_subscription_id = { @@ -102,6 +106,7 @@ blockchain_by_subscription_id = { "avalanche_fuji_blockchain": "avalanche_fuji", "blast_blockchain": "blast", "blast_sepolia_blockchain": "blast_sepolia", + "proofofplay_apex_blockchain": "proofofplay_apex", "ethereum_smartcontract": "ethereum", "polygon_smartcontract": "polygon", "mumbai_smartcontract": "mumbai", @@ -119,4 +124,5 @@ blockchain_by_subscription_id = { "avalanche_fuji_smartcontract": "avalanche_fuji", "blast_smartcontract": "blast", "blast_sepolia_smartcontract": "blast_sepolia", + "proofofplay_apex_smartcontract": "proofofplay_apex", } diff --git a/moonstreamdb/moonstreamdb/version.py b/moonstreamdb/moonstreamdb/version.py index 232cb871..c6c952de 100644 --- a/moonstreamdb/moonstreamdb/version.py +++ b/moonstreamdb/moonstreamdb/version.py @@ -2,4 +2,4 @@ Moonstream database version. """ -MOONSTREAMDB_VERSION = "0.4.1" +MOONSTREAMDB_VERSION = "0.4.2"