Merge pull request #1053 from moonstream-to/amoy-blockchain

Amoy blockchain support
pull/1054/head moonstreamdb/v0.4.1
Sergei Sumarokov 2024-04-15 14:02:33 +03:00 zatwierdzone przez GitHub
commit 1d0fcda13c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
37 zmienionych plików z 611 dodań i 341 usunięć

Wyświetl plik

@ -0,0 +1,11 @@
[Unit]
Description=Fill missing blocks at Amoy 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 amoy -n
CPUWeight=50
SyslogIdentifier=amoy-missing

Wyświetl plik

@ -0,0 +1,9 @@
[Unit]
Description=Fill missing blocks at Amoy database
[Timer]
OnBootSec=120s
OnUnitActiveSec=15m
[Install]
WantedBy=timers.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Amoy moonworm crawler
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 crawl -b amoy --confirmations 10 --min-blocks-batch 20
CPUWeight=70
SyslogIdentifier=amoy-moonworm-crawler
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Amoy block with transactions synchronizer
StartLimitIntervalSec=300
StartLimitBurst=3
After=network.target
[Service]
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 amoy -c 10 -j 2
CPUWeight=90
SyslogIdentifier=amoy-synchronize
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -48,6 +48,11 @@ 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"
AMOY_SYNCHRONIZE_SERVICE="amoy-synchronize.service"
# XDai service files
XDAI_SYNCHRONIZE_SERVICE="xdai-synchronize.service"
XDAI_MISSING_SERVICE_FILE="xdai-missing.service"
@ -211,23 +216,25 @@ cp "${SCRIPT_DIR}/${POLYGON_CU_NFT_DASHBOARD_TIMER_FILE}" "/home/ubuntu/.config/
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${POLYGON_CU_NFT_DASHBOARD_TIMER_FILE}"
# Amoy
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Mumbai block with transactions syncronizer service definition with ${MUMBAI_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${MUMBAI_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${MUMBAI_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_SYNCHRONIZE_SERVICE}"
echo -e "${PREFIX_INFO} Replacing existing Amoy block with transactions syncronizer service definition with ${AMOY_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${AMOY_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${AMOY_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${AMOY_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_SYNCHRONIZE_SERVICE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Mumbai missing service and timer with: ${MUMBAI_MISSING_SERVICE_FILE}, ${MUMBAI_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${MUMBAI_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${MUMBAI_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${MUMBAI_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${MUMBAI_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_MISSING_TIMER_FILE}"
echo -e "${PREFIX_INFO} Replacing existing Amoy missing service and timer with: ${AMOY_MISSING_SERVICE_FILE}, ${AMOY_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${AMOY_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${AMOY_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${AMOY_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${AMOY_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_MISSING_TIMER_FILE}"
# Xdai
echo
echo
echo -e "${PREFIX_INFO} Replacing existing XDai block with transactions syncronizer service definition with ${XDAI_SYNCHRONIZE_SERVICE}"

Wyświetl plik

@ -28,6 +28,7 @@ SCRIPT_DIR="$(realpath $(dirname $0))"
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"
ZKSYNC_ERA_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="zksync-era-sepolia-moonworm-crawler.service"
@ -97,11 +98,11 @@ XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${POLYGON_
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Mumbai moonworm crawler service definition with ${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}"
echo -e "${PREFIX_INFO} Replacing existing Amoy moonworm crawler service definition with ${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_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 "${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}"
echo
echo

Wyświetl plik

@ -81,6 +81,12 @@ MUMBAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="mumbai-historical-crawl-transac
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"
# XDai service files
XDAI_SYNCHRONIZE_SERVICE="xdai-synchronize.service"
XDAI_MISSING_SERVICE_FILE="xdai-missing.service"
@ -371,76 +377,33 @@ cp "${SCRIPT_DIR}/${POLYGON_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${POLYGON_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
# Amoy
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Mumbai block with transactions syncronizer service definition with ${MUMBAI_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${MUMBAI_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${MUMBAI_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_SYNCHRONIZE_SERVICE}"
echo -e "${PREFIX_INFO} Replacing existing Amoy block with transactions syncronizer service definition with ${AMOY_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${AMOY_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${AMOY_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${AMOY_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_SYNCHRONIZE_SERVICE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Mumbai missing service and timer with: ${MUMBAI_MISSING_SERVICE_FILE}, ${MUMBAI_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${MUMBAI_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${MUMBAI_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${MUMBAI_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${MUMBAI_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_MISSING_TIMER_FILE}"
echo -e "${PREFIX_INFO} Replacing existing Amoy missing service and timer with: ${AMOY_MISSING_SERVICE_FILE}, ${AMOY_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${AMOY_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${AMOY_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${AMOY_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${AMOY_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${MUMBAI_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AMOY_MISSING_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Mumbai moonworm crawler service definition with ${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MUMBAI_MOONWORM_CRAWLER_SERVICE_FILE}"
echo -e "${PREFIX_INFO} Replacing existing Amoy moonworm crawler service definition with ${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${AMOY_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AMOY_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 "${MUMBAI_MOONWORM_CRAWLER_SERVICE_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 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 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 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}"
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}"
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}"
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_MOONWORM_CRAWLER_SERVICE_FILE}"
# Xdai
echo
echo
echo -e "${PREFIX_INFO} Replacing existing XDai block with transactions syncronizer service definition with ${XDAI_SYNCHRONIZE_SERVICE}"

Wyświetl plik

@ -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 mumbai-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
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
CPUWeight=90
SyslogIdentifier=monitoring-crawlers

Wyświetl plik

@ -22,6 +22,7 @@ from .data import DateRange
from .db import yield_db_session, yield_db_session_ctx
from .settings import (
MOONSTREAM_CRAWL_WORKERS,
MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI,
MOONSTREAM_NODE_ARBITRUM_NOVA_A_EXTERNAL_URI,
MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI,
MOONSTREAM_NODE_AVALANCHE_A_EXTERNAL_URI,
@ -66,6 +67,8 @@ def connect(
web3_uri = MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI
elif blockchain_type == AvailableBlockchainType.MUMBAI:
web3_uri = MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI
elif blockchain_type == AvailableBlockchainType.AMOY:
web3_uri = MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI
elif blockchain_type == AvailableBlockchainType.XDAI:
web3_uri = MOONSTREAM_NODE_XDAI_A_EXTERNAL_URI
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:

Wyświetl plik

@ -4,6 +4,7 @@ from typing import Optional
from uuid import UUID
from moonstreamdb.blockchain import AvailableBlockchainType
from moonstreamdb.subscriptions import blockchain_type_to_subscription_type
from web3 import Web3
from web3.middleware import geth_poa_middleware
@ -15,8 +16,6 @@ from ..settings import (
)
from .continuous_crawler import _retry_connect_web3, continuous_crawler
from .crawler import (
SubscriptionTypes,
blockchain_type_to_subscription_type,
find_all_deployed_blocks,
get_crawl_job_entries,
make_event_crawl_jobs,

Wyświetl plik

@ -6,7 +6,8 @@ from typing import Dict, List, Optional, Tuple
from uuid import UUID
from moonstreamdb.blockchain import AvailableBlockchainType
from moonstreamdb.networks import Network
from moonstreamdb.networks import blockchain_type_to_network_type
from moonstreamdb.subscriptions import blockchain_type_to_subscription_type
from moonworm.crawler.moonstream_ethereum_state_provider import ( # type: ignore
MoonstreamEthereumStateProvider,
)
@ -21,7 +22,6 @@ from .crawler import (
EventCrawlJob,
FunctionCallCrawlJob,
_retry_connect_web3,
blockchain_type_to_subscription_type,
get_crawl_job_entries,
heartbeat,
make_event_crawl_jobs,
@ -124,40 +124,10 @@ def continuous_crawler(
if web3 is None:
web3 = _retry_connect_web3(blockchain_type, web3_uri=web3_uri)
if blockchain_type == AvailableBlockchainType.ETHEREUM:
network = Network.ethereum
elif blockchain_type == AvailableBlockchainType.POLYGON:
network = Network.polygon
elif blockchain_type == AvailableBlockchainType.MUMBAI:
network = Network.mumbai
elif blockchain_type == AvailableBlockchainType.XDAI:
network = Network.xdai
elif blockchain_type == AvailableBlockchainType.WYRM:
network = Network.wyrm
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
network = Network.zksync_era_testnet
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
network = Network.zksync_era
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
network = Network.zksync_era_sepolia
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
network = Network.arbitrum_nova
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
network = Network.arbitrum_sepolia
elif blockchain_type == AvailableBlockchainType.XAI:
network = Network.xai
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
network = Network.xai_sepolia
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
network = Network.avalanche
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
network = Network.avalanche_fuji
elif blockchain_type == AvailableBlockchainType.BLAST:
network = Network.blast
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
network = Network.blast_sepolia
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
try:
network = blockchain_type_to_network_type(blockchain_type=blockchain_type)
except Exception as e:
raise Exception(e)
ethereum_state_provider = MoonstreamEthereumStateProvider(
web3,

Wyświetl plik

@ -11,6 +11,7 @@ from uuid import UUID
from bugout.data import BugoutJournalEntries, BugoutSearchResult
from eth_typing.evm import ChecksumAddress
from moonstreamdb.blockchain import AvailableBlockchainType
from moonstreamdb.subscriptions import SubscriptionTypes
from moonworm.deployment import find_deployment_block # type: ignore
from web3.main import Web3
@ -29,25 +30,6 @@ logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class SubscriptionTypes(Enum):
POLYGON_BLOCKCHAIN = "polygon_smartcontract"
ETHEREUM_BLOCKCHAIN = "ethereum_smartcontract"
MUMBAI_BLOCKCHAIN = "mumbai_smartcontract"
XDAI_BLOCKCHAIN = "xdai_smartcontract"
WYRM_BLOCKCHAIN = "wyrm_smartcontract"
ZKSYNC_ERA_TESTNET_BLOCKCHAIN = "zksync_era_testnet_smartcontract"
ZKSYNC_ERA_BLOCKCHAIN = "zksync_era_smartcontract"
ZKSYNC_ERA_SEPOLIA_BLOCKCHAIN = "zksync_era_sepolia_smartcontract"
ARBITRUM_NOVA_BLOCKCHAIN = "arbitrum_nova_smartcontract"
ARBITRUM_SEPOLIA_BLOCKCHAIN = "arbitrum_sepolia_smartcontract"
XAI_BLOCKCHAIN = "xai_smartcontract"
XAI_SEPOLIA_BLOCKCHAIN = "xai_sepolia_smartcontract"
AVALANCHE_BLOCKCHAIN = "avalanche_smartcontract"
AVALANCHE_FUJI_BLOCKCHAIN = "avalanche_fuji_smartcontract"
BLAST_BLOCKCHAIN = "blast_smartcontract"
BLAST_SEPOLIA_BLOCKCHAIN = "blast_sepolia_smartcontract"
def abi_input_signature(input_abi: Dict[str, Any]) -> str:
"""
Stringifies a function ABI input object according to the ABI specification:
@ -137,45 +119,6 @@ def _retry_connect_web3(
)
def blockchain_type_to_subscription_type(
blockchain_type: AvailableBlockchainType,
) -> SubscriptionTypes:
if blockchain_type == AvailableBlockchainType.ETHEREUM:
return SubscriptionTypes.ETHEREUM_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.POLYGON:
return SubscriptionTypes.POLYGON_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.MUMBAI:
return SubscriptionTypes.MUMBAI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XDAI:
return SubscriptionTypes.XDAI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.WYRM:
return SubscriptionTypes.WYRM_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
return SubscriptionTypes.ZKSYNC_ERA_TESTNET_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
return SubscriptionTypes.ZKSYNC_ERA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
return SubscriptionTypes.ZKSYNC_ERA_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
return SubscriptionTypes.ARBITRUM_NOVA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
return SubscriptionTypes.ARBITRUM_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XAI:
return SubscriptionTypes.XAI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
return SubscriptionTypes.XAI_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
return SubscriptionTypes.AVALANCHE_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
return SubscriptionTypes.AVALANCHE_FUJI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.BLAST:
return SubscriptionTypes.BLAST_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
return SubscriptionTypes.BLAST_SEPOLIA_BLOCKCHAIN
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
@dataclass
class EventCrawlJob:
event_abi_hash: str

Wyświetl plik

@ -2,7 +2,7 @@ import logging
from typing import List
from moonstreamdb.blockchain import AvailableBlockchainType
from moonstreamdb.networks import Network # type: ignore
from moonstreamdb.networks import blockchain_type_to_network_type # type: ignore
from moonworm.crawler.function_call_crawler import ( # type: ignore
ContractFunctionCall,
FunctionCallCrawler,
@ -58,40 +58,10 @@ def function_call_crawler(
end_block: int,
batch_size: int,
):
if blockchain_type == AvailableBlockchainType.ETHEREUM:
network = Network.ethereum
elif blockchain_type == AvailableBlockchainType.POLYGON:
network = Network.polygon
elif blockchain_type == AvailableBlockchainType.MUMBAI:
network = Network.mumbai
elif blockchain_type == AvailableBlockchainType.XDAI:
network = Network.xdai
elif blockchain_type == AvailableBlockchainType.WYRM:
network = Network.wyrm
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
network = Network.zksync_era_testnet
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
network = Network.zksync_era
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
network = Network.zksync_era_sepolia
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
network = Network.arbitrum_nova
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
network = Network.arbitrum_sepolia
elif blockchain_type == AvailableBlockchainType.XAI:
network = Network.xai
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
network = Network.xai_sepolia
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
network = Network.avalanche
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
network = Network.avalanche_fuji
elif blockchain_type == AvailableBlockchainType.BLAST:
network = Network.blast
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
network = Network.blast_sepolia
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
try:
network = blockchain_type_to_network_type(blockchain_type=blockchain_type)
except Exception as e:
raise Exception(e)
ethereum_state_provider = MoonstreamEthereumStateProvider(
web3,

Wyświetl plik

@ -5,7 +5,7 @@ from uuid import UUID
from eth_typing.evm import ChecksumAddress
from moonstreamdb.blockchain import AvailableBlockchainType
from moonstreamdb.networks import Network # type: ignore
from moonstreamdb.networks import blockchain_type_to_network_type # type: ignore
from moonworm.crawler.moonstream_ethereum_state_provider import ( # type: ignore
MoonstreamEthereumStateProvider,
)
@ -52,40 +52,10 @@ def historical_crawler(
web3.eth.block_number >= start_block
), "start_block must be less than current block"
if blockchain_type == AvailableBlockchainType.ETHEREUM:
network = Network.ethereum
elif blockchain_type == AvailableBlockchainType.POLYGON:
network = Network.polygon
elif blockchain_type == AvailableBlockchainType.MUMBAI:
network = Network.mumbai
elif blockchain_type == AvailableBlockchainType.XDAI:
network = Network.xdai
elif blockchain_type == AvailableBlockchainType.WYRM:
network = Network.wyrm
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
network = Network.zksync_era_testnet
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
network = Network.zksync_era
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
network = Network.zksync_era_sepolia
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
network = Network.arbitrum_nova
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
network = Network.arbitrum_sepolia
elif blockchain_type == AvailableBlockchainType.XAI:
network = Network.xai
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
network = Network.xai_sepolia
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
network = Network.avalanche
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
network = Network.avalanche_fuji
elif blockchain_type == AvailableBlockchainType.BLAST:
network = Network.blast
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
network = Network.blast_sepolia
else:
raise Exception("Unsupported blockchain type provided")
try:
network = blockchain_type_to_network_type(blockchain_type=blockchain_type)
except Exception as e:
raise Exception(e)
ethereum_state_provider = MoonstreamEthereumStateProvider(
web3,

Wyświetl plik

@ -96,6 +96,12 @@ MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI = os.environ.get(
if MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI == "":
raise Exception("MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI env variable is not set")
MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI = os.environ.get(
"MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI", ""
)
if MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI == "":
raise Exception("MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI env variable is not set")
MOONSTREAM_NODE_XDAI_A_EXTERNAL_URI = os.environ.get(
"MOONSTREAM_NODE_XDAI_A_EXTERNAL_URI", ""
)

Wyświetl plik

@ -24,6 +24,10 @@ from moonstreamdb.blockchain import (
get_label_model,
get_transaction_model,
)
from moonstreamdb.subscriptions import (
blockchain_by_subscription_id,
subscription_id_by_blockchain,
)
from sqlalchemy import and_
from sqlalchemy import cast as sqlalchemy_cast
from sqlalchemy import distinct, extract, func, text
@ -47,61 +51,6 @@ logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
subscription_id_by_blockchain = {
"ethereum": "ethereum_smartcontract",
"polygon": "polygon_smartcontract",
"mumbai": "mumbai_smartcontract",
"xdai": "xdai_smartcontract",
"wyrm": "wyrm_smartcontract",
"zksync_era_testnet": "zksync_era_testnet_smartcontract",
"zksync_era": "zksync_era_smartcontract",
"zksync_era_sepolia": "zksync_era_sepolia_smartcontract",
"arbitrum_nova": "arbitrum_nova_smartcontract",
"arbitrum_sepolia": "arbitrum_sepolia_smartcontract",
"xai": "xai_smartcontract",
"xai_sepolia": "xai_sepolia_smartcontract",
"avalanche": "avalanche_smartcontract",
"avalanche_fuji": "avalanche_fuji_smartcontract",
"blast": "blast_smartcontract",
"blast_sepolia": "blast_sepolia_smartcontract",
}
blockchain_by_subscription_id = {
"ethereum_blockchain": "ethereum",
"polygon_blockchain": "polygon",
"mumbai_blockchain": "mumbai",
"xdai_blockchain": "xdai",
"wyrm_blockchain": "wyrm",
"zksync_era_testnet_blockchain": "zksync_era_testnet",
"zksync_era_blockchain": "zksync_era",
"zksync_era_sepolia_blockchain": "zksync_era_sepolia",
"arbitrum_nova_blockchain": "arbitrum_nova",
"arbitrum_sepolia_blockchain": "arbitrum_sepolia",
"xai_blockchain": "xai",
"xai_sepolia_blockchain": "xai_sepolia",
"avalanche_blockchain": "avalanche",
"avalanche_fuji_blockchain": "avalanche_fuji",
"blast_blockchain": "blast",
"blast_sepolia_blockchain": "blast_sepolia",
"ethereum_smartcontract": "ethereum",
"polygon_smartcontract": "polygon",
"mumbai_smartcontract": "mumbai",
"xdai_smartcontract": "xdai",
"wyrm_smartcontract": "wyrm",
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
"zksync_era_smartcontract": "zksync_era",
"zksync_era_sepolia_smartcontract": "zksync_era_sepolia",
"arbitrum_nova_smartcontract": "arbitrum_nova",
"arbitrum_sepolia_smartcontract": "arbitrum_sepolia",
"xai_smartcontract": "xai",
"xai_sepolia_smartcontract": "xai_sepolia",
"avalanche_smartcontract": "avalanche",
"avalanche_fuji_smartcontract": "avalanche_fuji",
"blast_smartcontract": "blast",
"blast_sepolia_smartcontract": "blast_sepolia",
}
class TimeScale(Enum):
# TODO(Andrey) Unlock when we be sure about perfomanse of agregation on transactions table.
# Right now it can be hungs

Wyświetl plik

@ -2,4 +2,4 @@
Moonstream crawlers version.
"""
MOONCRAWL_VERSION = "0.4.2"
MOONCRAWL_VERSION = "0.4.3"

Wyświetl plik

@ -24,6 +24,7 @@ export NFT_HUMBUG_TOKEN="<Token_for_nft_crawler>"
export MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_XDAI_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_ZKSYNC_ERA_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_ZKSYNC_ERA_SEPOLIA_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"

Wyświetl plik

@ -37,7 +37,7 @@ setup(
"bugout>=0.2.13",
"chardet",
"fastapi",
"moonstreamdb>=0.3.12",
"moonstreamdb>=0.4.1",
"moonstream>=0.1.1",
"moonworm[moonstream]>=0.6.2",
"humbug",

Wyświetl plik

@ -18,6 +18,7 @@ export HUMBUG_TXPOOL_CLIENT_ID="<Bugout_Humbug_client_id_for_txpool_transactions
export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_POLYGON_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_AMOY_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_XDAI_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_WYRM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"

Wyświetl plik

@ -25,6 +25,7 @@ from ens.utils import is_valid_ens_name # type: ignore
from eth_utils.address import is_address # type: ignore
from moonstreamdb.blockchain import AvailableBlockchainType
from moonstreamdb.models import EthereumLabel
from moonstreamdb.subscriptions import blockchain_by_subscription_id
from slugify import slugify # type: ignore
from sqlalchemy import text
from sqlalchemy.orm import Session
@ -52,42 +53,6 @@ from .web3_provider import FunctionSignature, connect, multicall
logger = logging.getLogger(__name__)
blockchain_by_subscription_id = {
"ethereum_blockchain": "ethereum",
"polygon_blockchain": "polygon",
"mumbai_blockchain": "mumbai",
"xdai_blockchain": "xdai",
"wyrm_blockchain": "wyrm",
"zksync_era_testnet_blockchain": "zksync_era_testnet",
"zksync_era_blockchain": "zksync_era",
"zksync_era_sepolia_blockchain": "zksync_era_sepolia",
"arbitrum_nova_blockchain": "arbitrum_nova",
"arbitrum_sepolia_blockchain": "arbitrum_sepolia",
"xai_blockchain": "xai",
"xai_sepolia_blockchain": "xai_sepolia",
"avalanche_blockchain": "avalanche",
"avalanche_fuji_blockchain": "avalanche_fuji",
"blast_blockchain": "blast",
"blast_sepolia_blockchain": "blast_sepolia",
"ethereum_smartcontract": "ethereum",
"polygon_smartcontract": "polygon",
"mumbai_smartcontract": "mumbai",
"xdai_smartcontract": "xdai",
"wyrm_smartcontract": "wyrm",
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
"zksync_era_smartcontract": "zksync_era",
"zksync_era_sepolia_smartcontract": "zksync_era_sepolia",
"arbitrum_nova_smartcontract": "arbitrum_nova",
"arbitrum_sepolia_smartcontract": "arbitrum_sepolia",
"xai_smartcontract": "xai",
"xai_sepolia_smartcontract": "xai_sepolia",
"avalanche_smartcontract": "avalanche",
"avalanche_fuji_smartcontract": "avalanche_fuji",
"blast_smartcontract": "blast",
"blast_sepolia_smartcontract": "blast_sepolia",
}
class StatusAPIException(Exception):
"""
Raised during checking Moonstream API statuses.

Wyświetl plik

@ -51,6 +51,17 @@ CANONICAL_SUBSCRIPTION_TYPES = {
stripe_price_id=None,
active=True,
),
"amoy_smartcontract": SubscriptionTypeResourceData(
id="amoy_smartcontract",
name="Amoy smartcontracts",
blockchain="amoy",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Amoy blockchain",
icon_url="https://static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"xdai_smartcontract": SubscriptionTypeResourceData(
id="xdai_smartcontract",
name="XDai smartcontract",
@ -227,6 +238,17 @@ CANONICAL_SUBSCRIPTION_TYPES = {
stripe_price_id=None,
active=False,
),
"amoy_blockchain": SubscriptionTypeResourceData(
id="amoy_blockchain",
name="Amoy transactions",
blockchain="amoy",
choices=["input:address", "tag:erc721"],
description="Transactions that have been mined into the Amoy blockchain",
icon_url="https://static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"xdai_blockchain": SubscriptionTypeResourceData(
id="xdai_blockchain",
name="XDai transactions",

Wyświetl plik

@ -50,6 +50,7 @@ event_providers: Dict[str, Any] = {
moonworm_provider.EthereumMoonwormProvider.event_type: moonworm_provider.EthereumMoonwormProvider,
moonworm_provider.PolygonMoonwormProvider.event_type: moonworm_provider.PolygonMoonwormProvider,
moonworm_provider.MumbaiMoonwormProvider.event_type: moonworm_provider.MumbaiMoonwormProvider,
moonworm_provider.AmoyMoonwormProvider.event_type: moonworm_provider.AmoyMoonwormProvider,
moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider,
moonworm_provider.ZkSyncEraTestnetMoonwormProvider.event_type: moonworm_provider.ZkSyncEraTestnetMoonwormProvider,
moonworm_provider.ZkSyncEraMoonwormProvider.event_type: moonworm_provider.ZkSyncEraMoonwormProvider,
@ -65,6 +66,7 @@ event_providers: Dict[str, Any] = {
transactions.EthereumTransactions.event_type: transactions.EthereumTransactions,
transactions.PolygonTransactions.event_type: transactions.PolygonTransactions,
transactions.MumbaiTransactions.event_type: transactions.MumbaiTransactions,
transactions.AmoyTransactions.event_type: transactions.AmoyTransactions,
transactions.XDaiTransactions.event_type: transactions.XDaiTransactions,
transactions.ZkSyncEraTestnetTransactions.event_type: transactions.ZkSyncEraTestnetTransactions,
transactions.ZkSyncEraTransactions.event_type: transactions.ZkSyncEraTransactions,

Wyświetl plik

@ -20,6 +20,7 @@ logger.setLevel(logging.WARN)
ethereum_event_type = "ethereum_blockchain"
polygon_event_type = "polygon_blockchain"
mumbai_event_type = "mumbai_blockchain"
amoy_event_type = "amoy_blockchain"
xdai_event_type = "xdai_blockchain"
zksync_era_testnet_event_type = "zksync_era_testnet_blockchain"
zksync_era_event_type = "zksync_era_blockchain"
@ -419,6 +420,13 @@ MumbaiMoonwormProvider = MoonwormProvider(
streamboaundary_range_limit=2 * 60 * 60,
)
AmoyMoonwormProvider = MoonwormProvider(
event_type="amoy_smartcontract",
blockchain=AvailableBlockchainType("amoy"),
description="Provider for reviving transactions from Amoy tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
XDaiMoonwormProvider = MoonwormProvider(
event_type="xdai_smartcontract",
blockchain=AvailableBlockchainType("xdai"),

Wyświetl plik

@ -469,6 +469,13 @@ MumbaiTransactions = TransactionsProvider(
streamboaundary_range_limit=2 * 60 * 60,
)
AmoyTransactions = TransactionsProvider(
event_type="amoy_blockchain",
blockchain=AvailableBlockchainType("amoy"),
description="Provider for resiving transactions from Amoy tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
XDaiTransactions = TransactionsProvider(
event_type="xdai_blockchain",
blockchain=AvailableBlockchainType("xdai"),

Wyświetl plik

@ -118,6 +118,12 @@ MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI = os.environ.get(
if MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_AMOY_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_AMOY_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_AMOY_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_AMOY_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_XDAI_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_XDAI_WEB3_PROVIDER_URI", ""
)

Wyświetl plik

@ -2,4 +2,4 @@
Moonstream library and API version.
"""
MOONSTREAMAPI_VERSION = "0.3.6"
MOONSTREAMAPI_VERSION = "0.4.1"

Wyświetl plik

@ -12,6 +12,7 @@ from web3.middleware import geth_poa_middleware
from web3.providers.rpc import HTTPProvider
from .settings import (
MOONSTREAM_AMOY_WEB3_PROVIDER_URI,
MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI,
MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI,
@ -74,6 +75,8 @@ def connect(
web3_uri = MOONSTREAM_POLYGON_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.MUMBAI:
web3_uri = MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.AMOY:
web3_uri = MOONSTREAM_AMOY_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.XDAI:
web3_uri = MOONSTREAM_XDAI_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.WYRM:

Wyświetl plik

@ -37,7 +37,7 @@ lru-dict==1.1.8
Mako==1.2.3
MarkupSafe==2.1.1
moonstream==0.1.1
moonstreamdb==0.3.12
moonstreamdb==0.4.1
multiaddr==0.0.9
multidict==6.0.2
netaddr==0.8.0

Wyświetl plik

@ -16,7 +16,7 @@ setup(
"bugout>=0.2.15",
"fastapi",
"moonstream",
"moonstreamdb>=0.3.12",
"moonstreamdb>=0.4.1",
"humbug",
"pydantic==1.10.2",
"pyevmasm",

Wyświetl plik

@ -25,6 +25,9 @@ target_metadata = MoonstreamBase.metadata
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
from moonstreamdb.models import (
AmoyBlock,
AmoyTransaction,
AmoyLabel,
ArbitrumNovaBlock,
ArbitrumNovaLabel,
ArbitrumNovaTransaction,
@ -90,6 +93,9 @@ def include_symbol(tablename, schema):
MumbaiBlock.__tablename__,
MumbaiTransaction.__tablename__,
MumbaiLabel.__tablename__,
AmoyBlock.__tablename__,
AmoyTransaction.__tablename__,
AmoyLabel.__tablename__,
ESDFunctionSignature.__tablename__,
ESDEventSignature.__tablename__,
OpenSeaCrawlingState.__tablename__,

Wyświetl plik

@ -0,0 +1,120 @@
"""Amoy blockchain
Revision ID: c8eaa4ff9d76
Revises: 181c5800cb1b
Create Date: 2024-04-15 08:06:30.569765
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'c8eaa4ff9d76'
down_revision = '181c5800cb1b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('amoy_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.PrimaryKeyConstraint('block_number', name=op.f('pk_amoy_blocks'))
)
op.create_index(op.f('ix_amoy_blocks_block_number'), 'amoy_blocks', ['block_number'], unique=True)
op.create_index(op.f('ix_amoy_blocks_hash'), 'amoy_blocks', ['hash'], unique=False)
op.create_index(op.f('ix_amoy_blocks_timestamp'), 'amoy_blocks', ['timestamp'], unique=False)
op.create_table('amoy_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_amoy_labels')),
sa.UniqueConstraint('id', name=op.f('uq_amoy_labels_id'))
)
op.create_index(op.f('ix_amoy_labels_address'), 'amoy_labels', ['address'], unique=False)
op.create_index('ix_amoy_labels_address_block_number', 'amoy_labels', ['address', 'block_number'], unique=False)
op.create_index('ix_amoy_labels_address_block_timestamp', 'amoy_labels', ['address', 'block_timestamp'], unique=False)
op.create_index(op.f('ix_amoy_labels_block_number'), 'amoy_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_amoy_labels_block_timestamp'), 'amoy_labels', ['block_timestamp'], unique=False)
op.create_index(op.f('ix_amoy_labels_label'), 'amoy_labels', ['label'], unique=False)
op.create_index(op.f('ix_amoy_labels_transaction_hash'), 'amoy_labels', ['transaction_hash'], unique=False)
op.create_table('amoy_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'], ['amoy_blocks.block_number'], name=op.f('fk_amoy_transactions_block_number_amoy_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_amoy_transactions'))
)
op.create_index(op.f('ix_amoy_transactions_block_number'), 'amoy_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_amoy_transactions_from_address'), 'amoy_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_amoy_transactions_gas'), 'amoy_transactions', ['gas'], unique=False)
op.create_index(op.f('ix_amoy_transactions_gas_price'), 'amoy_transactions', ['gas_price'], unique=False)
op.create_index(op.f('ix_amoy_transactions_hash'), 'amoy_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_amoy_transactions_to_address'), 'amoy_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_amoy_transactions_value'), 'amoy_transactions', ['value'], unique=False)
op.create_unique_constraint(op.f('uq_blast_labels_id'), 'blast_labels', ['id'])
op.create_unique_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', type_='unique')
op.drop_constraint(op.f('uq_blast_labels_id'), 'blast_labels', type_='unique')
op.drop_index(op.f('ix_amoy_transactions_value'), table_name='amoy_transactions')
op.drop_index(op.f('ix_amoy_transactions_to_address'), table_name='amoy_transactions')
op.drop_index(op.f('ix_amoy_transactions_hash'), table_name='amoy_transactions')
op.drop_index(op.f('ix_amoy_transactions_gas_price'), table_name='amoy_transactions')
op.drop_index(op.f('ix_amoy_transactions_gas'), table_name='amoy_transactions')
op.drop_index(op.f('ix_amoy_transactions_from_address'), table_name='amoy_transactions')
op.drop_index(op.f('ix_amoy_transactions_block_number'), table_name='amoy_transactions')
op.drop_table('amoy_transactions')
op.drop_index(op.f('ix_amoy_labels_transaction_hash'), table_name='amoy_labels')
op.drop_index(op.f('ix_amoy_labels_label'), table_name='amoy_labels')
op.drop_index(op.f('ix_amoy_labels_block_timestamp'), table_name='amoy_labels')
op.drop_index(op.f('ix_amoy_labels_block_number'), table_name='amoy_labels')
op.drop_index('ix_amoy_labels_address_block_timestamp', table_name='amoy_labels')
op.drop_index('ix_amoy_labels_address_block_number', table_name='amoy_labels')
op.drop_index(op.f('ix_amoy_labels_address'), table_name='amoy_labels')
op.drop_table('amoy_labels')
op.drop_index(op.f('ix_amoy_blocks_timestamp'), table_name='amoy_blocks')
op.drop_index(op.f('ix_amoy_blocks_hash'), table_name='amoy_blocks')
op.drop_index(op.f('ix_amoy_blocks_block_number'), table_name='amoy_blocks')
op.drop_table('amoy_blocks')
# ### end Alembic commands ###

Wyświetl plik

@ -2,6 +2,9 @@ from enum import Enum
from typing import Type, Union
from .models import (
AmoyBlock,
AmoyLabel,
AmoyTransaction,
ArbitrumNovaBlock,
ArbitrumNovaLabel,
ArbitrumNovaTransaction,
@ -57,6 +60,7 @@ class AvailableBlockchainType(Enum):
ETHEREUM = "ethereum"
POLYGON = "polygon"
MUMBAI = "mumbai"
AMOY = "amoy"
XDAI = "xdai"
WYRM = "wyrm"
ZKSYNC_ERA = "zksync_era"
@ -79,6 +83,7 @@ def get_block_model(
EthereumBlock,
PolygonBlock,
MumbaiBlock,
AmoyBlock,
XDaiBlock,
WyrmBlock,
ZkSyncEraTestnetBlock,
@ -95,14 +100,14 @@ def get_block_model(
]
]:
"""
Depends on provided blockchain type: Ethereum, Polygon, Mumbai, XDai, Wyrm, ZkSyncEra, ZkSyncEraTestnet, ArbitrumNova, ArbitrumSepolia, Xai, XaiSepolia
set proper blocks model.
Depends on provided blockchain type set proper blocks model.
"""
block_model: Type[
Union[
EthereumBlock,
PolygonBlock,
MumbaiBlock,
AmoyBlock,
XDaiBlock,
WyrmBlock,
ZkSyncEraTestnetBlock,
@ -124,6 +129,8 @@ def get_block_model(
block_model = PolygonBlock
elif blockchain_type == AvailableBlockchainType.MUMBAI:
block_model = MumbaiBlock
elif blockchain_type == AvailableBlockchainType.AMOY:
block_model = AmoyBlock
elif blockchain_type == AvailableBlockchainType.XDAI:
block_model = XDaiBlock
elif blockchain_type == AvailableBlockchainType.WYRM:
@ -163,6 +170,7 @@ def get_label_model(
EthereumLabel,
PolygonLabel,
MumbaiLabel,
AmoyLabel,
XDaiLabel,
WyrmLabel,
ZkSyncEraTestnetLabel,
@ -179,14 +187,14 @@ def get_label_model(
]
]:
"""
Depends on provided blockchain type: Ethereum, Polygon, Mumbai, XDai, Wyrm, ZkSyncEra, ZkSyncEraTestnet, ArbitrumNova, ArbitrumSepolia, Xai, XaiSepolia
set proper block label model.
Depends on provided blockchain type set proper block label model.
"""
label_model: Type[
Union[
EthereumLabel,
PolygonLabel,
MumbaiLabel,
AmoyLabel,
XDaiLabel,
WyrmLabel,
ZkSyncEraTestnetLabel,
@ -208,6 +216,8 @@ def get_label_model(
label_model = PolygonLabel
elif blockchain_type == AvailableBlockchainType.MUMBAI:
label_model = MumbaiLabel
elif blockchain_type == AvailableBlockchainType.AMOY:
label_model = AmoyLabel
elif blockchain_type == AvailableBlockchainType.XDAI:
label_model = XDaiLabel
elif blockchain_type == AvailableBlockchainType.WYRM:
@ -247,6 +257,7 @@ def get_transaction_model(
EthereumTransaction,
PolygonTransaction,
MumbaiTransaction,
AmoyTransaction,
XDaiTransaction,
WyrmTransaction,
ZkSyncEraTestnetTransaction,
@ -263,14 +274,14 @@ def get_transaction_model(
]
]:
"""
Depends on provided blockchain type: Ethereum, Polygon, Mumbai, XDai, Wyrm, ZkSyncEra, ZkSyncEraTestnet, ArbitrumNova, ArbitrumSepolia, Xai, XaiSepolia
set proper block transactions model.
Depends on provided blockchain type set proper block transactions model.
"""
transaction_model: Type[
Union[
EthereumTransaction,
PolygonTransaction,
MumbaiTransaction,
AmoyTransaction,
XDaiTransaction,
WyrmTransaction,
ZkSyncEraTestnetTransaction,
@ -292,6 +303,8 @@ def get_transaction_model(
transaction_model = PolygonTransaction
elif blockchain_type == AvailableBlockchainType.MUMBAI:
transaction_model = MumbaiTransaction
elif blockchain_type == AvailableBlockchainType.AMOY:
transaction_model = AmoyTransaction
elif blockchain_type == AvailableBlockchainType.XDAI:
transaction_model = XDaiTransaction
elif blockchain_type == AvailableBlockchainType.WYRM:

Wyświetl plik

@ -368,6 +368,113 @@ class MumbaiLabel(Base): # type: ignore
)
class AmoyBlock(Base): # type: ignore
__tablename__ = "amoy_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
)
class AmoyTransaction(Base): # type: ignore
__tablename__ = "amoy_transactions"
hash = Column(
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
)
block_number = Column(
BigInteger,
ForeignKey("amoy_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
)
class AmoyLabel(Base): # type: ignore
__tablename__ = "amoy_labels"
__table_args__ = (
Index(
"ix_amoy_labels_address_block_number",
"address",
"block_number",
unique=False,
),
Index(
"ix_amoy_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 XDaiBlock(Base): # type: ignore
__tablename__ = "xdai_blocks"

Wyświetl plik

@ -1,7 +1,11 @@
from enum import Enum
from typing import Dict, Union
from .blockchain import AvailableBlockchainType
from .models import (
AmoyBlock,
AmoyLabel,
AmoyTransaction,
ArbitrumNovaBlock,
ArbitrumNovaLabel,
ArbitrumNovaTransaction,
@ -58,6 +62,7 @@ class Network(Enum):
ethereum = "ethereum"
polygon = "polygon"
mumbai = "mumbai"
amoy = "amoy"
xdai = "xdai"
wyrm = "wyrm"
zksync_era_testnet = "zksync_era_testnet"
@ -76,6 +81,7 @@ class Network(Enum):
tx_raw_types = Union[
EthereumTransaction,
MumbaiTransaction,
AmoyTransaction,
PolygonTransaction,
WyrmTransaction,
XDaiTransaction,
@ -103,6 +109,11 @@ MODELS: Dict[Network, Dict[str, Base]] = {
"labels": MumbaiLabel,
"transactions": MumbaiTransaction,
},
Network.amoy: {
"blocks": AmoyBlock,
"labels": AmoyLabel,
"transactions": AmoyTransaction,
},
Network.polygon: {
"blocks": PolygonBlock,
"labels": PolygonLabel,
@ -174,3 +185,44 @@ MODELS: Dict[Network, Dict[str, Base]] = {
"transactions": BlastSepoliaTransaction,
},
}
def blockchain_type_to_network_type(
blockchain_type: AvailableBlockchainType,
) -> Network:
if blockchain_type == AvailableBlockchainType.ETHEREUM:
return Network.ethereum
elif blockchain_type == AvailableBlockchainType.POLYGON:
return Network.polygon
elif blockchain_type == AvailableBlockchainType.MUMBAI:
return Network.mumbai
elif blockchain_type == AvailableBlockchainType.AMOY:
return Network.amoy
elif blockchain_type == AvailableBlockchainType.XDAI:
return Network.xdai
elif blockchain_type == AvailableBlockchainType.WYRM:
return Network.wyrm
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
return Network.zksync_era_testnet
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
return Network.zksync_era
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
return Network.zksync_era_sepolia
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
return Network.arbitrum_nova
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
return Network.arbitrum_sepolia
elif blockchain_type == AvailableBlockchainType.XAI:
return Network.xai
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
return Network.xai_sepolia
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
return Network.avalanche
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
return Network.avalanche_fuji
elif blockchain_type == AvailableBlockchainType.BLAST:
return Network.blast
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
return Network.blast_sepolia
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")

Wyświetl plik

@ -0,0 +1,122 @@
from enum import Enum
from .blockchain import AvailableBlockchainType
class SubscriptionTypes(Enum):
POLYGON_BLOCKCHAIN = "polygon_smartcontract"
ETHEREUM_BLOCKCHAIN = "ethereum_smartcontract"
MUMBAI_BLOCKCHAIN = "mumbai_smartcontract"
AMOY_BLOCKCHAIN = "amoy_smartcontract"
XDAI_BLOCKCHAIN = "xdai_smartcontract"
WYRM_BLOCKCHAIN = "wyrm_smartcontract"
ZKSYNC_ERA_TESTNET_BLOCKCHAIN = "zksync_era_testnet_smartcontract"
ZKSYNC_ERA_BLOCKCHAIN = "zksync_era_smartcontract"
ZKSYNC_ERA_SEPOLIA_BLOCKCHAIN = "zksync_era_sepolia_smartcontract"
ARBITRUM_NOVA_BLOCKCHAIN = "arbitrum_nova_smartcontract"
ARBITRUM_SEPOLIA_BLOCKCHAIN = "arbitrum_sepolia_smartcontract"
XAI_BLOCKCHAIN = "xai_smartcontract"
XAI_SEPOLIA_BLOCKCHAIN = "xai_sepolia_smartcontract"
AVALANCHE_BLOCKCHAIN = "avalanche_smartcontract"
AVALANCHE_FUJI_BLOCKCHAIN = "avalanche_fuji_smartcontract"
BLAST_BLOCKCHAIN = "blast_smartcontract"
BLAST_SEPOLIA_BLOCKCHAIN = "blast_sepolia_smartcontract"
def blockchain_type_to_subscription_type(
blockchain_type: AvailableBlockchainType,
) -> SubscriptionTypes:
if blockchain_type == AvailableBlockchainType.ETHEREUM:
return SubscriptionTypes.ETHEREUM_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.POLYGON:
return SubscriptionTypes.POLYGON_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.MUMBAI:
return SubscriptionTypes.MUMBAI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.AMOY:
return SubscriptionTypes.AMOY_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XDAI:
return SubscriptionTypes.XDAI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.WYRM:
return SubscriptionTypes.WYRM_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
return SubscriptionTypes.ZKSYNC_ERA_TESTNET_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
return SubscriptionTypes.ZKSYNC_ERA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
return SubscriptionTypes.ZKSYNC_ERA_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
return SubscriptionTypes.ARBITRUM_NOVA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
return SubscriptionTypes.ARBITRUM_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XAI:
return SubscriptionTypes.XAI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
return SubscriptionTypes.XAI_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
return SubscriptionTypes.AVALANCHE_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
return SubscriptionTypes.AVALANCHE_FUJI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.BLAST:
return SubscriptionTypes.BLAST_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
return SubscriptionTypes.BLAST_SEPOLIA_BLOCKCHAIN
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
subscription_id_by_blockchain = {
"ethereum": "ethereum_smartcontract",
"polygon": "polygon_smartcontract",
"mumbai": "mumbai_smartcontract",
"amoy": "amoy_smartcontract",
"xdai": "xdai_smartcontract",
"wyrm": "wyrm_smartcontract",
"zksync_era_testnet": "zksync_era_testnet_smartcontract",
"zksync_era": "zksync_era_smartcontract",
"zksync_era_sepolia": "zksync_era_sepolia_smartcontract",
"arbitrum_nova": "arbitrum_nova_smartcontract",
"arbitrum_sepolia": "arbitrum_sepolia_smartcontract",
"xai": "xai_smartcontract",
"xai_sepolia": "xai_sepolia_smartcontract",
"avalanche": "avalanche_smartcontract",
"avalanche_fuji": "avalanche_fuji_smartcontract",
"blast": "blast_smartcontract",
"blast_sepolia": "blast_sepolia_smartcontract",
}
blockchain_by_subscription_id = {
"ethereum_blockchain": "ethereum",
"polygon_blockchain": "polygon",
"mumbai_blockchain": "mumbai",
"amoy_blockchain": "amoy",
"xdai_blockchain": "xdai",
"wyrm_blockchain": "wyrm",
"zksync_era_testnet_blockchain": "zksync_era_testnet",
"zksync_era_blockchain": "zksync_era",
"zksync_era_sepolia_blockchain": "zksync_era_sepolia",
"arbitrum_nova_blockchain": "arbitrum_nova",
"arbitrum_sepolia_blockchain": "arbitrum_sepolia",
"xai_blockchain": "xai",
"xai_sepolia_blockchain": "xai_sepolia",
"avalanche_blockchain": "avalanche",
"avalanche_fuji_blockchain": "avalanche_fuji",
"blast_blockchain": "blast",
"blast_sepolia_blockchain": "blast_sepolia",
"ethereum_smartcontract": "ethereum",
"polygon_smartcontract": "polygon",
"mumbai_smartcontract": "mumbai",
"amoy_smartcontract": "amoy",
"xdai_smartcontract": "xdai",
"wyrm_smartcontract": "wyrm",
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
"zksync_era_smartcontract": "zksync_era",
"zksync_era_sepolia_smartcontract": "zksync_era_sepolia",
"arbitrum_nova_smartcontract": "arbitrum_nova",
"arbitrum_sepolia_smartcontract": "arbitrum_sepolia",
"xai_smartcontract": "xai",
"xai_sepolia_smartcontract": "xai_sepolia",
"avalanche_smartcontract": "avalanche",
"avalanche_fuji_smartcontract": "avalanche_fuji",
"blast_smartcontract": "blast",
"blast_sepolia_smartcontract": "blast_sepolia",
}

Wyświetl plik

@ -2,4 +2,4 @@
Moonstream database version.
"""
MOONSTREAMDB_VERSION = "0.3.12"
MOONSTREAMDB_VERSION = "0.4.1"