Merge branch 'main' into moonworm-jobs-v3-sync-cli

pull/1082/head
kompotkot 2024-06-11 08:43:18 +00:00
commit 8b2da8cc0f
21 zmienionych plików z 1698 dodań i 10 usunięć

Wyświetl plik

@ -72,6 +72,19 @@ PROOFOFPLAY_APEX_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="proofofplay-apex-hist
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"
# XAI
XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="xai-historical-crawl-transactions.service"
XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="xai-historical-crawl-transactions.timer"
XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="xai-historical-crawl-events.service"
XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="xai-historical-crawl-events.timer"
# XAI Sepolia
XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="xai-sepolia-historical-crawl-transactions.service"
XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="xai-sepolia-historical-crawl-transactions.timer"
XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="xai-sepolia-historical-crawl-events.service"
XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="xai-sepolia-historical-crawl-events.timer"
set -eu
echo
@ -253,4 +266,40 @@ chmod 644 "${SCRIPT_DIR}/${ARBITRUM_ONE_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "
cp "${SCRIPT_DIR}/${ARBITRUM_ONE_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${ARBITRUM_ONE_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${ARBITRUM_ONE_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${ARBITRUM_ONE_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 "${ARBITRUM_ONE_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${ARBITRUM_ONE_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing XAI historical transactions crawler service and timer with: ${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_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 "${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing XAI historical events crawler service and timer with: ${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_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 "${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing XAI Sepolia historical transactions crawler service and timer with: ${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_SEPOLIA_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 "${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing XAI Sepolia historical events crawler service and timer with: ${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_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 "${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"

Wyświetl plik

@ -136,12 +136,21 @@ XAI_MISSING_SERVICE_FILE="xai-missing.service"
XAI_MISSING_TIMER_FILE="xai-missing.timer"
XAI_MOONWORM_CRAWLER_SERVICE_FILE="xai-moonworm-crawler.service"
XAI_SYNCHRONIZE_SERVICE="xai-synchronize.service"
XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="xai-historical-crawl-events.service"
XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="xai-historical-crawl-events.timer"
XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="xai-historical-crawl-transactions.service"
XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="xai-historical-crawl-transactions.timer"
# Xai sepolia
XAI_SEPOLIA_MISSING_SERVICE_FILE="xai-sepolia-missing.service"
XAI_SEPOLIA_MISSING_TIMER_FILE="xai-sepolia-missing.timer"
XAI_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="xai-sepolia-moonworm-crawler.service"
XAI_SEPOLIA_SYNCHRONIZE_SERVICE="xai-sepolia-synchronize.service"
XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE="xai-sepolia-historical-crawl-events.service"
XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE="xai-sepolia-historical-crawl-events.timer"
XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE="xai-sepolia-historical-crawl-transactions.service"
XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE="xai-sepolia-historical-crawl-transactions.timer"
# Avalanche
AVALANCHE_SYNCHRONIZE_SERVICE="avalanche-synchronize.service"
@ -713,6 +722,25 @@ cp "${SCRIPT_DIR}/${XAI_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/sy
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${XAI_MOONWORM_CRAWLER_SERVICE_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Xai historical transactions crawler service and timer with: ${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_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 "${XAI_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Xai historical events crawler service and timer with: ${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_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 "${XAI_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
# Xai sepolia
echo
@ -740,6 +768,24 @@ cp "${SCRIPT_DIR}/${XAI_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.c
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${XAI_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Xai sepolia historical transactions crawler service and timer with: ${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}, ${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_SEPOLIA_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 "${XAI_SEPOLIA_HISTORICAL_CRAWL_TRANSACTIONS_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Xai sepolia historical events crawler service and timer with: ${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}, ${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${XAI_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 "${XAI_SEPOLIA_HISTORICAL_CRAWL_EVENTS_TIMER_FILE}"
# Avalanche
echo
echo

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Xai 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 xai --find-deployed-blocks --end 0 --tasks-journal --only-events
CPUWeight=70
SyslogIdentifier=xai-historical-crawl-events
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,9 @@
[Unit]
Description=Runs events historical crawler on xai
[Timer]
OnBootSec=60s
OnUnitActiveSec=10m
[Install]
WantedBy=timers.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Xai 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 xai --find-deployed-blocks --end 0 --tasks-journal --only-functions
CPUWeight=70
SyslogIdentifier=xai-historical-crawl-transactions
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,9 @@
[Unit]
Description=Runs transactions historical crawler on xai
[Timer]
OnBootSec=60s
OnUnitActiveSec=10m
[Install]
WantedBy=timers.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Xai sepolia 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 xai_sepolia --find-deployed-blocks --end 0 --tasks-journal --only-events
CPUWeight=70
SyslogIdentifier=xai-sepolia-historical-crawl-events
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,9 @@
[Unit]
Description=Runs events historical crawler on xai sepolia
[Timer]
OnBootSec=60s
OnUnitActiveSec=10m
[Install]
WantedBy=timers.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Xai sepolia 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 xai_sepolia --find-deployed-blocks --end 0 --tasks-journal --only-functions
CPUWeight=70
SyslogIdentifier=xai-sepolia-historical-crawl-transactions
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,9 @@
[Unit]
Description=Runs transactions historical crawler on xai sepolia
[Timer]
OnBootSec=60s
OnUnitActiveSec=10m
[Install]
WantedBy=timers.target

Wyświetl plik

@ -0,0 +1,34 @@
"""Chain ID is big int
Revision ID: a9060d0527e3
Revises: 7191eb70e99e
Create Date: 2024-06-03 07:32:28.111259
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a9060d0527e3'
down_revision = '7191eb70e99e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('blockchains', 'chain_id',
existing_type=sa.INTEGER(),
type_=sa.BigInteger(),
existing_nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('blockchains', 'chain_id',
existing_type=sa.BigInteger(),
type_=sa.INTEGER(),
existing_nullable=False)
# ### end Alembic commands ###

Wyświetl plik

@ -215,7 +215,7 @@ class Blockchain(Base): # type: ignore
unique=True,
)
name = Column(VARCHAR(128), nullable=False, index=True, unique=True)
chain_id = Column(Integer, nullable=False, index=True, unique=False)
chain_id = Column(BigInteger, nullable=False, index=True, unique=False)
testnet = Column(Boolean, default=False, nullable=False)
registered_contracts = relationship(

Wyświetl plik

@ -39,6 +39,7 @@ from moonstreamdbv3.models import (
ArbitrumNovaLabel,
ArbitrumOneLabel,
ArbitrumSepoliaLabel,
Game7OrbitArbitrumSepoliaLabel,
XaiLabel,
XaiSepoliaLabel,
AvalancheLabel,
@ -48,6 +49,8 @@ from moonstreamdbv3.models import (
ProofOfPlayApexLabel,
StarknetLabel,
StarknetSepoliaLabel,
MantleLabel,
MantleSepoliaLabel,
)
@ -63,7 +66,9 @@ def include_symbol(tablename, schema):
ZkSyncEraSepoliaLabel.__tablename__,
BaseLabel.__tablename__,
ArbitrumNovaLabel.__tablename__,
ArbitrumOneLabel.__tablename__,
ArbitrumSepoliaLabel.__tablename__,
Game7OrbitArbitrumSepoliaLabel.__tablename__,
XaiLabel.__tablename__,
XaiSepoliaLabel.__tablename__,
AvalancheLabel.__tablename__,
@ -73,6 +78,8 @@ def include_symbol(tablename, schema):
ProofOfPlayApexLabel.__tablename__,
StarknetLabel.__tablename__,
StarknetSepoliaLabel.__tablename__,
MantleLabel.__tablename__,
MantleSepoliaLabel.__tablename__,
}

Wyświetl plik

@ -0,0 +1,157 @@
"""Game7 Orbit and Mantle blockchain models
Revision ID: 9ca39b11e12a
Revises: d2ceff33be47
Create Date: 2024-05-29 13:17:07.194421
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '9ca39b11e12a'
down_revision: Union[str, None] = 'd2ceff33be47'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('game7_orbit_arbitrum_sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), 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_game7_orbit_arbitrum_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_game7_orbit_arbitrum_sepolia_labels_id'))
)
op.create_index('ix_g7o_arbitrum_sepolia_labels_addr_block_num', 'game7_orbit_arbitrum_sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index('ix_g7o_arbitrum_sepolia_labels_addr_block_ts', 'game7_orbit_arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_address'), 'game7_orbit_arbitrum_sepolia_labels', ['address'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_block_number'), 'game7_orbit_arbitrum_sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_caller_address'), 'game7_orbit_arbitrum_sepolia_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_label'), 'game7_orbit_arbitrum_sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_label_name'), 'game7_orbit_arbitrum_sepolia_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_label_type'), 'game7_orbit_arbitrum_sepolia_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_origin_address'), 'game7_orbit_arbitrum_sepolia_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_transaction_hash'), 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash'], unique=False)
op.create_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt', 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'"))
op.create_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call', 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
op.create_table('mantle_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), 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_mantle_labels')),
sa.UniqueConstraint('id', name=op.f('uq_mantle_labels_id'))
)
op.create_index('ix_mantle_labels_addr_block_num', 'mantle_labels', ['address', 'block_number'], unique=False)
op.create_index('ix_mantle_labels_addr_block_ts', 'mantle_labels', ['address', 'block_timestamp'], unique=False)
op.create_index(op.f('ix_mantle_labels_address'), 'mantle_labels', ['address'], unique=False)
op.create_index(op.f('ix_mantle_labels_block_number'), 'mantle_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_mantle_labels_caller_address'), 'mantle_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_mantle_labels_label'), 'mantle_labels', ['label'], unique=False)
op.create_index(op.f('ix_mantle_labels_label_name'), 'mantle_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_mantle_labels_label_type'), 'mantle_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_mantle_labels_origin_address'), 'mantle_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_mantle_labels_transaction_hash'), 'mantle_labels', ['transaction_hash'], unique=False)
op.create_index('uk_mantle_labels_tx_hash_log_idx_evt', 'mantle_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'"))
op.create_index('uk_mantle_labels_tx_hash_tx_call', 'mantle_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
op.create_table('mantle_sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), 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_mantle_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_mantle_sepolia_labels_id'))
)
op.create_index('ix_mantle_sepolia_labels_addr_block_num', 'mantle_sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index('ix_mantle_sepolia_labels_addr_block_ts', 'mantle_sepolia_labels', ['address', 'block_timestamp'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_address'), 'mantle_sepolia_labels', ['address'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_block_number'), 'mantle_sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_caller_address'), 'mantle_sepolia_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_label'), 'mantle_sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_label_name'), 'mantle_sepolia_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_label_type'), 'mantle_sepolia_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_origin_address'), 'mantle_sepolia_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_labels_transaction_hash'), 'mantle_sepolia_labels', ['transaction_hash'], unique=False)
op.create_index('uk_mantle_sepolia_labels_tx_hash_log_idx_evt', 'mantle_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'"))
op.create_index('uk_mantle_sepolia_labels_tx_hash_tx_call', 'mantle_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('uk_mantle_sepolia_labels_tx_hash_tx_call', table_name='mantle_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
op.drop_index('uk_mantle_sepolia_labels_tx_hash_log_idx_evt', table_name='mantle_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'"))
op.drop_index(op.f('ix_mantle_sepolia_labels_transaction_hash'), table_name='mantle_sepolia_labels')
op.drop_index(op.f('ix_mantle_sepolia_labels_origin_address'), table_name='mantle_sepolia_labels')
op.drop_index(op.f('ix_mantle_sepolia_labels_label_type'), table_name='mantle_sepolia_labels')
op.drop_index(op.f('ix_mantle_sepolia_labels_label_name'), table_name='mantle_sepolia_labels')
op.drop_index(op.f('ix_mantle_sepolia_labels_label'), table_name='mantle_sepolia_labels')
op.drop_index(op.f('ix_mantle_sepolia_labels_caller_address'), table_name='mantle_sepolia_labels')
op.drop_index(op.f('ix_mantle_sepolia_labels_block_number'), table_name='mantle_sepolia_labels')
op.drop_index(op.f('ix_mantle_sepolia_labels_address'), table_name='mantle_sepolia_labels')
op.drop_index('ix_mantle_sepolia_labels_addr_block_ts', table_name='mantle_sepolia_labels')
op.drop_index('ix_mantle_sepolia_labels_addr_block_num', table_name='mantle_sepolia_labels')
op.drop_table('mantle_sepolia_labels')
op.drop_index('uk_mantle_labels_tx_hash_tx_call', table_name='mantle_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
op.drop_index('uk_mantle_labels_tx_hash_log_idx_evt', table_name='mantle_labels', postgresql_where=sa.text("label='seer' and label_type='event'"))
op.drop_index(op.f('ix_mantle_labels_transaction_hash'), table_name='mantle_labels')
op.drop_index(op.f('ix_mantle_labels_origin_address'), table_name='mantle_labels')
op.drop_index(op.f('ix_mantle_labels_label_type'), table_name='mantle_labels')
op.drop_index(op.f('ix_mantle_labels_label_name'), table_name='mantle_labels')
op.drop_index(op.f('ix_mantle_labels_label'), table_name='mantle_labels')
op.drop_index(op.f('ix_mantle_labels_caller_address'), table_name='mantle_labels')
op.drop_index(op.f('ix_mantle_labels_block_number'), table_name='mantle_labels')
op.drop_index(op.f('ix_mantle_labels_address'), table_name='mantle_labels')
op.drop_index('ix_mantle_labels_addr_block_ts', table_name='mantle_labels')
op.drop_index('ix_mantle_labels_addr_block_num', table_name='mantle_labels')
op.drop_table('mantle_labels')
op.drop_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
op.drop_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'"))
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_transaction_hash'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_origin_address'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_label_type'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_label_name'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_label'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_caller_address'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_block_number'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_labels_address'), table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index('ix_g7o_arbitrum_sepolia_labels_addr_block_ts', table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_index('ix_g7o_arbitrum_sepolia_labels_addr_block_num', table_name='game7_orbit_arbitrum_sepolia_labels')
op.drop_table('game7_orbit_arbitrum_sepolia_labels')
# ### end Alembic commands ###

Wyświetl plik

@ -36,6 +36,34 @@ from moonstreamdbv3.models_indexes import (
PolygonTransactionIndex,
PolygonLogIndex,
PolygonReorgs,
XaiBlockIndex,
XaiTransactionIndex,
XaiLogIndex,
XaiReorgs,
XaiSepoliaBlockIndex,
XaiSepoliaTransactionIndex,
XaiSepoliaLogIndex,
XaiSepoliaReorgs,
ArbitrumOneBlockIndex,
ArbitrumOneTransactionIndex,
ArbitrumOneLogIndex,
ArbitrumOneReorgs,
ArbitrumSepoliaBlockIndex,
ArbitrumSepoliaTransactionIndex,
ArbitrumSepoliaLogIndex,
ArbitrumSepoliaReorgs,
Game7OrbitArbitrumSepoliaBlockIndex,
Game7OrbitArbitrumSepoliaTransactionIndex,
Game7OrbitArbitrumSepoliaLogIndex,
Game7OrbitArbitrumSepoliaReorgs,
MantleBlockIndex,
MantleTransactionIndex,
MantleLogIndex,
MantleReorgs,
MantleSepoliaBlockIndex,
MantleSepoliaTransactionIndex,
MantleSepoliaLogIndex,
MantleSepoliaReorgs,
AbiJobs,
)
@ -50,6 +78,34 @@ def include_symbol(tablename, schema):
PolygonTransactionIndex.__tablename__,
PolygonLogIndex.__tablename__,
PolygonReorgs.__tablename__,
XaiBlockIndex.__tablename__,
XaiTransactionIndex.__tablename__,
XaiLogIndex.__tablename__,
XaiReorgs.__tablename__,
XaiSepoliaBlockIndex.__tablename__,
XaiSepoliaTransactionIndex.__tablename__,
XaiSepoliaLogIndex.__tablename__,
XaiSepoliaReorgs.__tablename__,
ArbitrumOneBlockIndex.__tablename__,
ArbitrumOneTransactionIndex.__tablename__,
ArbitrumOneLogIndex.__tablename__,
ArbitrumOneReorgs.__tablename__,
ArbitrumSepoliaBlockIndex.__tablename__,
ArbitrumSepoliaTransactionIndex.__tablename__,
ArbitrumSepoliaLogIndex.__tablename__,
ArbitrumSepoliaReorgs.__tablename__,
Game7OrbitArbitrumSepoliaBlockIndex.__tablename__,
Game7OrbitArbitrumSepoliaTransactionIndex.__tablename__,
Game7OrbitArbitrumSepoliaLogIndex.__tablename__,
Game7OrbitArbitrumSepoliaReorgs.__tablename__,
MantleBlockIndex.__tablename__,
MantleTransactionIndex.__tablename__,
MantleLogIndex.__tablename__,
MantleReorgs.__tablename__,
MantleSepoliaBlockIndex.__tablename__,
MantleSepoliaTransactionIndex.__tablename__,
MantleSepoliaLogIndex.__tablename__,
MantleSepoliaReorgs.__tablename__,
AbiJobs.__tablename__,
}

Wyświetl plik

@ -0,0 +1,597 @@
"""Game7 Orbit, Arbitrum, Xai and Mantle blockchain indexes models
Revision ID: a4ef4f9031e4
Revises: 0ea24314c181
Create Date: 2024-05-29 13:19:42.833716
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'a4ef4f9031e4'
down_revision: Union[str, None] = '0ea24314c181'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('arbitrum_one_blocks',
sa.Column('l1_block_number', sa.BigInteger(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
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_arbitrum_one_blocks'))
)
op.create_index(op.f('ix_arbitrum_one_blocks_block_number'), 'arbitrum_one_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_one_blocks_block_timestamp'), 'arbitrum_one_blocks', ['block_timestamp'], unique=False)
op.create_table('arbitrum_one_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_arbitrum_one_reorgs'))
)
op.create_index(op.f('ix_arbitrum_one_reorgs_block_hash'), 'arbitrum_one_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_arbitrum_one_reorgs_block_number'), 'arbitrum_one_reorgs', ['block_number'], unique=False)
op.create_table('arbitrum_sepolia_blocks',
sa.Column('l1_block_number', sa.BigInteger(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
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_arbitrum_sepolia_blocks'))
)
op.create_index(op.f('ix_arbitrum_sepolia_blocks_block_number'), 'arbitrum_sepolia_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_blocks_block_timestamp'), 'arbitrum_sepolia_blocks', ['block_timestamp'], unique=False)
op.create_table('arbitrum_sepolia_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_arbitrum_sepolia_reorgs'))
)
op.create_index(op.f('ix_arbitrum_sepolia_reorgs_block_hash'), 'arbitrum_sepolia_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_reorgs_block_number'), 'arbitrum_sepolia_reorgs', ['block_number'], unique=False)
op.create_table('game7_orbit_arbitrum_sepolia_blocks',
sa.Column('l1_block_number', sa.BigInteger(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
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_game7_orbit_arbitrum_sepolia_blocks'))
)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_blocks_block_number'), 'game7_orbit_arbitrum_sepolia_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_blocks_block_timestamp'), 'game7_orbit_arbitrum_sepolia_blocks', ['block_timestamp'], unique=False)
op.create_table('game7_orbit_arbitrum_sepolia_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_game7_orbit_arbitrum_sepolia_reorgs'))
)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_reorgs_block_hash'), 'game7_orbit_arbitrum_sepolia_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_reorgs_block_number'), 'game7_orbit_arbitrum_sepolia_reorgs', ['block_number'], unique=False)
op.create_table('mantle_blocks',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
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_mantle_blocks'))
)
op.create_index(op.f('ix_mantle_blocks_block_number'), 'mantle_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_mantle_blocks_block_timestamp'), 'mantle_blocks', ['block_timestamp'], unique=False)
op.create_table('mantle_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_mantle_reorgs'))
)
op.create_index(op.f('ix_mantle_reorgs_block_hash'), 'mantle_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_mantle_reorgs_block_number'), 'mantle_reorgs', ['block_number'], unique=False)
op.create_table('mantle_sepolia_blocks',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
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_mantle_sepolia_blocks'))
)
op.create_index(op.f('ix_mantle_sepolia_blocks_block_number'), 'mantle_sepolia_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_blocks_block_timestamp'), 'mantle_sepolia_blocks', ['block_timestamp'], unique=False)
op.create_table('mantle_sepolia_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_mantle_sepolia_reorgs'))
)
op.create_index(op.f('ix_mantle_sepolia_reorgs_block_hash'), 'mantle_sepolia_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_reorgs_block_number'), 'mantle_sepolia_reorgs', ['block_number'], unique=False)
op.create_table('xai_blocks',
sa.Column('l1_block_number', sa.BigInteger(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
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_xai_blocks'))
)
op.create_index(op.f('ix_xai_blocks_block_number'), 'xai_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_xai_blocks_block_timestamp'), 'xai_blocks', ['block_timestamp'], unique=False)
op.create_table('xai_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_xai_reorgs'))
)
op.create_index(op.f('ix_xai_reorgs_block_hash'), 'xai_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_xai_reorgs_block_number'), 'xai_reorgs', ['block_number'], unique=False)
op.create_table('xai_sepolia_blocks',
sa.Column('l1_block_number', sa.BigInteger(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
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_xai_sepolia_blocks'))
)
op.create_index(op.f('ix_xai_sepolia_blocks_block_number'), 'xai_sepolia_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_xai_sepolia_blocks_block_timestamp'), 'xai_sepolia_blocks', ['block_timestamp'], unique=False)
op.create_table('xai_sepolia_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_xai_sepolia_reorgs'))
)
op.create_index(op.f('ix_xai_sepolia_reorgs_block_hash'), 'xai_sepolia_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_xai_sepolia_reorgs_block_number'), 'xai_sepolia_reorgs', ['block_number'], unique=False)
op.create_table('arbitrum_one_transactions',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('from_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('to_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('type', sa.Integer(), nullable=True),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['block_number'], ['arbitrum_one_blocks.block_number'], name=op.f('fk_arbitrum_one_transactions_block_number_arbitrum_one_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_arbitrum_one_transactions'))
)
op.create_index(op.f('ix_arbitrum_one_transactions_block_hash'), 'arbitrum_one_transactions', ['block_hash'], unique=False)
op.create_index(op.f('ix_arbitrum_one_transactions_block_number'), 'arbitrum_one_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_one_transactions_from_address'), 'arbitrum_one_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_arbitrum_one_transactions_hash'), 'arbitrum_one_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_arbitrum_one_transactions_index'), 'arbitrum_one_transactions', ['index'], unique=False)
op.create_index(op.f('ix_arbitrum_one_transactions_selector'), 'arbitrum_one_transactions', ['selector'], unique=False)
op.create_index(op.f('ix_arbitrum_one_transactions_to_address'), 'arbitrum_one_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_arbitrum_one_transactions_type'), 'arbitrum_one_transactions', ['type'], unique=False)
op.create_table('arbitrum_sepolia_transactions',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('from_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('to_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('type', sa.Integer(), nullable=True),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['block_number'], ['arbitrum_sepolia_blocks.block_number'], name=op.f('fk_arbitrum_sepolia_transactions_block_number_arbitrum_sepolia_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_arbitrum_sepolia_transactions'))
)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_block_hash'), 'arbitrum_sepolia_transactions', ['block_hash'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_block_number'), 'arbitrum_sepolia_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_from_address'), 'arbitrum_sepolia_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_hash'), 'arbitrum_sepolia_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_index'), 'arbitrum_sepolia_transactions', ['index'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_selector'), 'arbitrum_sepolia_transactions', ['selector'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_to_address'), 'arbitrum_sepolia_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_transactions_type'), 'arbitrum_sepolia_transactions', ['type'], unique=False)
op.create_table('game7_orbit_arbitrum_sepolia_transactions',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('from_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('to_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('type', sa.Integer(), nullable=True),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['block_number'], ['game7_orbit_arbitrum_sepolia_blocks.block_number'], name=op.f('fk_game7_orbit_arbitrum_sepolia_transactions_block_number_game7_orbit_arbitrum_sepolia_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_game7_orbit_arbitrum_sepolia_transactions'))
)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_block_hash'), 'game7_orbit_arbitrum_sepolia_transactions', ['block_hash'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_block_number'), 'game7_orbit_arbitrum_sepolia_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_from_address'), 'game7_orbit_arbitrum_sepolia_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_hash'), 'game7_orbit_arbitrum_sepolia_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_index'), 'game7_orbit_arbitrum_sepolia_transactions', ['index'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_selector'), 'game7_orbit_arbitrum_sepolia_transactions', ['selector'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_to_address'), 'game7_orbit_arbitrum_sepolia_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_type'), 'game7_orbit_arbitrum_sepolia_transactions', ['type'], unique=False)
op.create_table('mantle_sepolia_transactions',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('from_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('to_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('type', sa.Integer(), nullable=True),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['block_number'], ['mantle_sepolia_blocks.block_number'], name=op.f('fk_mantle_sepolia_transactions_block_number_mantle_sepolia_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_mantle_sepolia_transactions'))
)
op.create_index(op.f('ix_mantle_sepolia_transactions_block_hash'), 'mantle_sepolia_transactions', ['block_hash'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_transactions_block_number'), 'mantle_sepolia_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_transactions_from_address'), 'mantle_sepolia_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_transactions_hash'), 'mantle_sepolia_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_mantle_sepolia_transactions_index'), 'mantle_sepolia_transactions', ['index'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_transactions_selector'), 'mantle_sepolia_transactions', ['selector'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_transactions_to_address'), 'mantle_sepolia_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_transactions_type'), 'mantle_sepolia_transactions', ['type'], unique=False)
op.create_table('mantle_transactions',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('from_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('to_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('type', sa.Integer(), nullable=True),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['block_number'], ['mantle_blocks.block_number'], name=op.f('fk_mantle_transactions_block_number_mantle_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_mantle_transactions'))
)
op.create_index(op.f('ix_mantle_transactions_block_hash'), 'mantle_transactions', ['block_hash'], unique=False)
op.create_index(op.f('ix_mantle_transactions_block_number'), 'mantle_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_mantle_transactions_from_address'), 'mantle_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_mantle_transactions_hash'), 'mantle_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_mantle_transactions_index'), 'mantle_transactions', ['index'], unique=False)
op.create_index(op.f('ix_mantle_transactions_selector'), 'mantle_transactions', ['selector'], unique=False)
op.create_index(op.f('ix_mantle_transactions_to_address'), 'mantle_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_mantle_transactions_type'), 'mantle_transactions', ['type'], unique=False)
op.create_table('xai_sepolia_transactions',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('from_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('to_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('type', sa.Integer(), nullable=True),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['block_number'], ['xai_sepolia_blocks.block_number'], name=op.f('fk_xai_sepolia_transactions_block_number_xai_sepolia_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_xai_sepolia_transactions'))
)
op.create_index(op.f('ix_xai_sepolia_transactions_block_hash'), 'xai_sepolia_transactions', ['block_hash'], unique=False)
op.create_index(op.f('ix_xai_sepolia_transactions_block_number'), 'xai_sepolia_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_xai_sepolia_transactions_from_address'), 'xai_sepolia_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_xai_sepolia_transactions_hash'), 'xai_sepolia_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_xai_sepolia_transactions_index'), 'xai_sepolia_transactions', ['index'], unique=False)
op.create_index(op.f('ix_xai_sepolia_transactions_selector'), 'xai_sepolia_transactions', ['selector'], unique=False)
op.create_index(op.f('ix_xai_sepolia_transactions_to_address'), 'xai_sepolia_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_xai_sepolia_transactions_type'), 'xai_sepolia_transactions', ['type'], unique=False)
op.create_table('xai_transactions',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('from_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('to_address', sa.LargeBinary(length=20), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('type', sa.Integer(), nullable=True),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['block_number'], ['xai_blocks.block_number'], name=op.f('fk_xai_transactions_block_number_xai_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_xai_transactions'))
)
op.create_index(op.f('ix_xai_transactions_block_hash'), 'xai_transactions', ['block_hash'], unique=False)
op.create_index(op.f('ix_xai_transactions_block_number'), 'xai_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_xai_transactions_from_address'), 'xai_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_xai_transactions_hash'), 'xai_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_xai_transactions_index'), 'xai_transactions', ['index'], unique=False)
op.create_index(op.f('ix_xai_transactions_selector'), 'xai_transactions', ['selector'], unique=False)
op.create_index(op.f('ix_xai_transactions_to_address'), 'xai_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_xai_transactions_type'), 'xai_transactions', ['type'], unique=False)
op.create_table('arbitrum_one_logs',
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.LargeBinary(length=20), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic1', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic2', sa.VARCHAR(length=256), nullable=True),
sa.Column('log_index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['arbitrum_one_transactions.hash'], name=op.f('fk_arbitrum_one_logs_transaction_hash_arbitrum_one_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('transaction_hash', 'log_index', name='pk_arbitrum_one_log_index'),
sa.UniqueConstraint('transaction_hash', 'log_index', name='uq_arbitrum_one_log_idx_tx_hash_log_idx')
)
op.create_index(op.f('ix_arbitrum_one_logs_address'), 'arbitrum_one_logs', ['address'], unique=False)
op.create_index(op.f('ix_arbitrum_one_logs_block_hash'), 'arbitrum_one_logs', ['block_hash'], unique=False)
op.create_index(op.f('ix_arbitrum_one_logs_transaction_hash'), 'arbitrum_one_logs', ['transaction_hash'], unique=False)
op.create_table('arbitrum_sepolia_logs',
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.LargeBinary(length=20), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic1', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic2', sa.VARCHAR(length=256), nullable=True),
sa.Column('log_index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['arbitrum_sepolia_transactions.hash'], name=op.f('fk_arbitrum_sepolia_logs_transaction_hash_arbitrum_sepolia_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('transaction_hash', 'log_index', name='pk_arbitrum_sepolia_log_index'),
sa.UniqueConstraint('transaction_hash', 'log_index', name='uq_arbitrum_sepolia_log_idx_tx_hash_log_idx')
)
op.create_index(op.f('ix_arbitrum_sepolia_logs_address'), 'arbitrum_sepolia_logs', ['address'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_logs_block_hash'), 'arbitrum_sepolia_logs', ['block_hash'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_logs_transaction_hash'), 'arbitrum_sepolia_logs', ['transaction_hash'], unique=False)
op.create_table('game7_orbit_arbitrum_sepolia_logs',
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.LargeBinary(length=20), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic1', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic2', sa.VARCHAR(length=256), nullable=True),
sa.Column('log_index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['game7_orbit_arbitrum_sepolia_transactions.hash'], name=op.f('fk_game7_orbit_arbitrum_sepolia_logs_transaction_hash_game7_orbit_arbitrum_sepolia_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('transaction_hash', 'log_index', name='pk_game7_orbit_arbitrum_sepolia_log_index'),
sa.UniqueConstraint('transaction_hash', 'log_index', name='uq_g7o_arbitrum_sepolia_log_idx_tx_hash_log_idx')
)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_logs_address'), 'game7_orbit_arbitrum_sepolia_logs', ['address'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_logs_block_hash'), 'game7_orbit_arbitrum_sepolia_logs', ['block_hash'], unique=False)
op.create_index(op.f('ix_game7_orbit_arbitrum_sepolia_logs_transaction_hash'), 'game7_orbit_arbitrum_sepolia_logs', ['transaction_hash'], unique=False)
op.create_table('mantle_logs',
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.LargeBinary(length=20), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic1', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic2', sa.VARCHAR(length=256), nullable=True),
sa.Column('log_index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['mantle_transactions.hash'], name=op.f('fk_mantle_logs_transaction_hash_mantle_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('transaction_hash', 'log_index', name='pk_mantle_log_index'),
sa.UniqueConstraint('transaction_hash', 'log_index', name='uq_mantle_log_index_transaction_hash_log_index')
)
op.create_index('idx_mantle_logs_block_hash_log_index', 'mantle_logs', ['block_hash', 'log_index'], unique=True)
op.create_index(op.f('ix_mantle_logs_address'), 'mantle_logs', ['address'], unique=False)
op.create_index(op.f('ix_mantle_logs_block_hash'), 'mantle_logs', ['block_hash'], unique=False)
op.create_index(op.f('ix_mantle_logs_transaction_hash'), 'mantle_logs', ['transaction_hash'], unique=False)
op.create_table('mantle_sepolia_logs',
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.LargeBinary(length=20), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic1', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic2', sa.VARCHAR(length=256), nullable=True),
sa.Column('log_index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['mantle_sepolia_transactions.hash'], name=op.f('fk_mantle_sepolia_logs_transaction_hash_mantle_sepolia_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('transaction_hash', 'log_index', name='pk_mantle_sepolia_log_index'),
sa.UniqueConstraint('transaction_hash', 'log_index', name='uq_mantle_sepolia_log_index_transaction_hash_log_index')
)
op.create_index('idx_mantle_sepolia_logs_block_hash_log_index', 'mantle_sepolia_logs', ['block_hash', 'log_index'], unique=True)
op.create_index(op.f('ix_mantle_sepolia_logs_address'), 'mantle_sepolia_logs', ['address'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_logs_block_hash'), 'mantle_sepolia_logs', ['block_hash'], unique=False)
op.create_index(op.f('ix_mantle_sepolia_logs_transaction_hash'), 'mantle_sepolia_logs', ['transaction_hash'], unique=False)
op.create_table('xai_logs',
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.LargeBinary(length=20), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic1', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic2', sa.VARCHAR(length=256), nullable=True),
sa.Column('log_index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['xai_transactions.hash'], name=op.f('fk_xai_logs_transaction_hash_xai_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('transaction_hash', 'log_index', name='pk_xai_log_index'),
sa.UniqueConstraint('transaction_hash', 'log_index', name='uq_xai_log_idx_tx_hash_log_idx')
)
op.create_index(op.f('ix_xai_logs_address'), 'xai_logs', ['address'], unique=False)
op.create_index(op.f('ix_xai_logs_block_hash'), 'xai_logs', ['block_hash'], unique=False)
op.create_index(op.f('ix_xai_logs_transaction_hash'), 'xai_logs', ['transaction_hash'], unique=False)
op.create_table('xai_sepolia_logs',
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.LargeBinary(length=20), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('selector', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic1', sa.VARCHAR(length=256), nullable=True),
sa.Column('topic2', sa.VARCHAR(length=256), nullable=True),
sa.Column('log_index', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['xai_sepolia_transactions.hash'], name=op.f('fk_xai_sepolia_logs_transaction_hash_xai_sepolia_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('transaction_hash', 'log_index', name='pk_xai_sepolia_log_index'),
sa.UniqueConstraint('transaction_hash', 'log_index', name='uq_xai_sepolia_log_idx_tx_hash_log_idx')
)
op.create_index(op.f('ix_xai_sepolia_logs_address'), 'xai_sepolia_logs', ['address'], unique=False)
op.create_index(op.f('ix_xai_sepolia_logs_block_hash'), 'xai_sepolia_logs', ['block_hash'], unique=False)
op.create_index(op.f('ix_xai_sepolia_logs_transaction_hash'), 'xai_sepolia_logs', ['transaction_hash'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_xai_sepolia_logs_transaction_hash'), table_name='xai_sepolia_logs')
op.drop_index(op.f('ix_xai_sepolia_logs_block_hash'), table_name='xai_sepolia_logs')
op.drop_index(op.f('ix_xai_sepolia_logs_address'), table_name='xai_sepolia_logs')
op.drop_table('xai_sepolia_logs')
op.drop_index(op.f('ix_xai_logs_transaction_hash'), table_name='xai_logs')
op.drop_index(op.f('ix_xai_logs_block_hash'), table_name='xai_logs')
op.drop_index(op.f('ix_xai_logs_address'), table_name='xai_logs')
op.drop_table('xai_logs')
op.drop_index(op.f('ix_mantle_sepolia_logs_transaction_hash'), table_name='mantle_sepolia_logs')
op.drop_index(op.f('ix_mantle_sepolia_logs_block_hash'), table_name='mantle_sepolia_logs')
op.drop_index(op.f('ix_mantle_sepolia_logs_address'), table_name='mantle_sepolia_logs')
op.drop_index('idx_mantle_sepolia_logs_block_hash_log_index', table_name='mantle_sepolia_logs')
op.drop_table('mantle_sepolia_logs')
op.drop_index(op.f('ix_mantle_logs_transaction_hash'), table_name='mantle_logs')
op.drop_index(op.f('ix_mantle_logs_block_hash'), table_name='mantle_logs')
op.drop_index(op.f('ix_mantle_logs_address'), table_name='mantle_logs')
op.drop_index('idx_mantle_logs_block_hash_log_index', table_name='mantle_logs')
op.drop_table('mantle_logs')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_logs_transaction_hash'), table_name='game7_orbit_arbitrum_sepolia_logs')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_logs_block_hash'), table_name='game7_orbit_arbitrum_sepolia_logs')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_logs_address'), table_name='game7_orbit_arbitrum_sepolia_logs')
op.drop_table('game7_orbit_arbitrum_sepolia_logs')
op.drop_index(op.f('ix_arbitrum_sepolia_logs_transaction_hash'), table_name='arbitrum_sepolia_logs')
op.drop_index(op.f('ix_arbitrum_sepolia_logs_block_hash'), table_name='arbitrum_sepolia_logs')
op.drop_index(op.f('ix_arbitrum_sepolia_logs_address'), table_name='arbitrum_sepolia_logs')
op.drop_table('arbitrum_sepolia_logs')
op.drop_index(op.f('ix_arbitrum_one_logs_transaction_hash'), table_name='arbitrum_one_logs')
op.drop_index(op.f('ix_arbitrum_one_logs_block_hash'), table_name='arbitrum_one_logs')
op.drop_index(op.f('ix_arbitrum_one_logs_address'), table_name='arbitrum_one_logs')
op.drop_table('arbitrum_one_logs')
op.drop_index(op.f('ix_xai_transactions_type'), table_name='xai_transactions')
op.drop_index(op.f('ix_xai_transactions_to_address'), table_name='xai_transactions')
op.drop_index(op.f('ix_xai_transactions_selector'), table_name='xai_transactions')
op.drop_index(op.f('ix_xai_transactions_index'), table_name='xai_transactions')
op.drop_index(op.f('ix_xai_transactions_hash'), table_name='xai_transactions')
op.drop_index(op.f('ix_xai_transactions_from_address'), table_name='xai_transactions')
op.drop_index(op.f('ix_xai_transactions_block_number'), table_name='xai_transactions')
op.drop_index(op.f('ix_xai_transactions_block_hash'), table_name='xai_transactions')
op.drop_table('xai_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_type'), table_name='xai_sepolia_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_to_address'), table_name='xai_sepolia_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_selector'), table_name='xai_sepolia_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_index'), table_name='xai_sepolia_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_hash'), table_name='xai_sepolia_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_from_address'), table_name='xai_sepolia_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_block_number'), table_name='xai_sepolia_transactions')
op.drop_index(op.f('ix_xai_sepolia_transactions_block_hash'), table_name='xai_sepolia_transactions')
op.drop_table('xai_sepolia_transactions')
op.drop_index(op.f('ix_mantle_transactions_type'), table_name='mantle_transactions')
op.drop_index(op.f('ix_mantle_transactions_to_address'), table_name='mantle_transactions')
op.drop_index(op.f('ix_mantle_transactions_selector'), table_name='mantle_transactions')
op.drop_index(op.f('ix_mantle_transactions_index'), table_name='mantle_transactions')
op.drop_index(op.f('ix_mantle_transactions_hash'), table_name='mantle_transactions')
op.drop_index(op.f('ix_mantle_transactions_from_address'), table_name='mantle_transactions')
op.drop_index(op.f('ix_mantle_transactions_block_number'), table_name='mantle_transactions')
op.drop_index(op.f('ix_mantle_transactions_block_hash'), table_name='mantle_transactions')
op.drop_table('mantle_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_type'), table_name='mantle_sepolia_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_to_address'), table_name='mantle_sepolia_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_selector'), table_name='mantle_sepolia_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_index'), table_name='mantle_sepolia_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_hash'), table_name='mantle_sepolia_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_from_address'), table_name='mantle_sepolia_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_block_number'), table_name='mantle_sepolia_transactions')
op.drop_index(op.f('ix_mantle_sepolia_transactions_block_hash'), table_name='mantle_sepolia_transactions')
op.drop_table('mantle_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_type'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_to_address'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_selector'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_index'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_hash'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_from_address'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_block_number'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_transactions_block_hash'), table_name='game7_orbit_arbitrum_sepolia_transactions')
op.drop_table('game7_orbit_arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_type'), table_name='arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_to_address'), table_name='arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_selector'), table_name='arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_index'), table_name='arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_hash'), table_name='arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_from_address'), table_name='arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_block_number'), table_name='arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_sepolia_transactions_block_hash'), table_name='arbitrum_sepolia_transactions')
op.drop_table('arbitrum_sepolia_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_type'), table_name='arbitrum_one_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_to_address'), table_name='arbitrum_one_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_selector'), table_name='arbitrum_one_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_index'), table_name='arbitrum_one_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_hash'), table_name='arbitrum_one_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_from_address'), table_name='arbitrum_one_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_block_number'), table_name='arbitrum_one_transactions')
op.drop_index(op.f('ix_arbitrum_one_transactions_block_hash'), table_name='arbitrum_one_transactions')
op.drop_table('arbitrum_one_transactions')
op.drop_index(op.f('ix_xai_sepolia_reorgs_block_number'), table_name='xai_sepolia_reorgs')
op.drop_index(op.f('ix_xai_sepolia_reorgs_block_hash'), table_name='xai_sepolia_reorgs')
op.drop_table('xai_sepolia_reorgs')
op.drop_index(op.f('ix_xai_sepolia_blocks_block_timestamp'), table_name='xai_sepolia_blocks')
op.drop_index(op.f('ix_xai_sepolia_blocks_block_number'), table_name='xai_sepolia_blocks')
op.drop_table('xai_sepolia_blocks')
op.drop_index(op.f('ix_xai_reorgs_block_number'), table_name='xai_reorgs')
op.drop_index(op.f('ix_xai_reorgs_block_hash'), table_name='xai_reorgs')
op.drop_table('xai_reorgs')
op.drop_index(op.f('ix_xai_blocks_block_timestamp'), table_name='xai_blocks')
op.drop_index(op.f('ix_xai_blocks_block_number'), table_name='xai_blocks')
op.drop_table('xai_blocks')
op.drop_index(op.f('ix_mantle_sepolia_reorgs_block_number'), table_name='mantle_sepolia_reorgs')
op.drop_index(op.f('ix_mantle_sepolia_reorgs_block_hash'), table_name='mantle_sepolia_reorgs')
op.drop_table('mantle_sepolia_reorgs')
op.drop_index(op.f('ix_mantle_sepolia_blocks_block_timestamp'), table_name='mantle_sepolia_blocks')
op.drop_index(op.f('ix_mantle_sepolia_blocks_block_number'), table_name='mantle_sepolia_blocks')
op.drop_table('mantle_sepolia_blocks')
op.drop_index(op.f('ix_mantle_reorgs_block_number'), table_name='mantle_reorgs')
op.drop_index(op.f('ix_mantle_reorgs_block_hash'), table_name='mantle_reorgs')
op.drop_table('mantle_reorgs')
op.drop_index(op.f('ix_mantle_blocks_block_timestamp'), table_name='mantle_blocks')
op.drop_index(op.f('ix_mantle_blocks_block_number'), table_name='mantle_blocks')
op.drop_table('mantle_blocks')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_reorgs_block_number'), table_name='game7_orbit_arbitrum_sepolia_reorgs')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_reorgs_block_hash'), table_name='game7_orbit_arbitrum_sepolia_reorgs')
op.drop_table('game7_orbit_arbitrum_sepolia_reorgs')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_blocks_block_timestamp'), table_name='game7_orbit_arbitrum_sepolia_blocks')
op.drop_index(op.f('ix_game7_orbit_arbitrum_sepolia_blocks_block_number'), table_name='game7_orbit_arbitrum_sepolia_blocks')
op.drop_table('game7_orbit_arbitrum_sepolia_blocks')
op.drop_index(op.f('ix_arbitrum_sepolia_reorgs_block_number'), table_name='arbitrum_sepolia_reorgs')
op.drop_index(op.f('ix_arbitrum_sepolia_reorgs_block_hash'), table_name='arbitrum_sepolia_reorgs')
op.drop_table('arbitrum_sepolia_reorgs')
op.drop_index(op.f('ix_arbitrum_sepolia_blocks_block_timestamp'), table_name='arbitrum_sepolia_blocks')
op.drop_index(op.f('ix_arbitrum_sepolia_blocks_block_number'), table_name='arbitrum_sepolia_blocks')
op.drop_table('arbitrum_sepolia_blocks')
op.drop_index(op.f('ix_arbitrum_one_reorgs_block_number'), table_name='arbitrum_one_reorgs')
op.drop_index(op.f('ix_arbitrum_one_reorgs_block_hash'), table_name='arbitrum_one_reorgs')
op.drop_table('arbitrum_one_reorgs')
op.drop_index(op.f('ix_arbitrum_one_blocks_block_timestamp'), table_name='arbitrum_one_blocks')
op.drop_index(op.f('ix_arbitrum_one_blocks_block_number'), table_name='arbitrum_one_blocks')
op.drop_table('arbitrum_one_blocks')
# ### end Alembic commands ###

Wyświetl plik

@ -0,0 +1,103 @@
"""Logs address selector index
Revision ID: e02c90ea67bb
Revises: a4ef4f9031e4
Create Date: 2024-06-06 13:12:14.594600
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "e02c90ea67bb"
down_revision: Union[str, None] = "a4ef4f9031e4"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_index(
"idx_arbitrum_one_logs_address_selector",
"arbitrum_one_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_arbitrum_sepolia_logs_address_selector",
"arbitrum_sepolia_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_ethereum_logs_address_selector",
"ethereum_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_game7_orbit_arbitrum_sepolia_logs_address_selector",
"game7_orbit_arbitrum_sepolia_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_mantle_logs_address_selector",
"mantle_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_mantle_sepolia_logs_address_selector",
"mantle_sepolia_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_polygon_logs_address_selector",
"polygon_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_xai_logs_address_selector",
"xai_logs",
["address", "selector"],
unique=False,
)
op.create_index(
"idx_xai_sepolia_logs_address_selector",
"xai_sepolia_logs",
["address", "selector"],
unique=False,
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
"idx_xai_sepolia_logs_address_selector", table_name="xai_sepolia_logs"
)
op.drop_index("idx_xai_logs_address_selector", table_name="xai_logs")
op.drop_index("idx_polygon_logs_address_selector", table_name="polygon_logs")
op.drop_index(
"idx_mantle_sepolia_logs_address_selector", table_name="mantle_sepolia_logs"
)
op.drop_index("idx_mantle_logs_address_selector", table_name="mantle_logs")
op.drop_index(
"idx_game7_orbit_arbitrum_sepolia_logs_address_selector",
table_name="game7_orbit_arbitrum_sepolia_logs",
)
op.drop_index("idx_ethereum_logs_address_selector", table_name="ethereum_logs")
op.drop_index(
"idx_arbitrum_sepolia_logs_address_selector", table_name="arbitrum_sepolia_logs"
)
op.drop_index(
"idx_arbitrum_one_logs_address_selector", table_name="arbitrum_one_logs"
)
# ### end Alembic commands ###

Wyświetl plik

@ -7,21 +7,29 @@ import os
from contextlib import contextmanager
from typing import Generator, Optional
from sqlalchemy import create_engine, Engine
from sqlalchemy import Engine, create_engine
from sqlalchemy.orm import Session, sessionmaker
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
try:
MOONSTREAM_DB_URI = os.environ.get("MOONSTREAM_DB_V3_INDEXES_URI")
if MOONSTREAM_DB_URI is None:
MOONSTREAM_DB_V3_URI = os.environ.get("MOONSTREAM_DB_V3_URI")
if MOONSTREAM_DB_V3_URI is None:
raise Warning("MOONSTREAM_DB_V3_URI environment variable must be set")
MOONSTREAM_DB_V3_URI_READ_ONLY = os.environ.get("MOONSTREAM_DB_V3_URI_READ_ONLY")
if MOONSTREAM_DB_V3_URI_READ_ONLY is None:
raise Warning("MOONSTREAM_DB_V3_URI_READ_ONLY environment variable must be set")
MOONSTREAM_DB_V3_INDEXES_URI = os.environ.get("MOONSTREAM_DB_V3_INDEXES_URI")
if MOONSTREAM_DB_V3_INDEXES_URI is None:
raise Warning("MOONSTREAM_DB_V3_INDEXES_URI environment variable must be set")
MOONSTREAM_DB_URI_READ_ONLY = os.environ.get(
MOONSTREAM_DB_V3_INDEXES_URI_READ_ONLY = os.environ.get(
"MOONSTREAM_DB_V3_INDEXES_URI_READ_ONLY"
)
if MOONSTREAM_DB_URI_READ_ONLY is None:
if MOONSTREAM_DB_V3_INDEXES_URI_READ_ONLY is None:
raise Warning(
"MOONSTREAM_DB_V3_INDEXES_URI_READ_ONLY environment variable must be set"
)
@ -91,7 +99,7 @@ class DBEngine:
class MoonstreamDBEngine(DBEngine):
def __init__(self, schema: Optional[str] = None) -> None:
super().__init__(url=MOONSTREAM_DB_URI, schema=schema)
super().__init__(url=MOONSTREAM_DB_V3_URI, schema=schema)
self._session_local = sessionmaker(bind=self.engine)
@ -122,7 +130,73 @@ class MoonstreamDBEngine(DBEngine):
class MoonstreamDBEngineRO(DBEngine):
def __init__(self, schema: Optional[str] = None) -> None:
super().__init__(url=MOONSTREAM_DB_URI_READ_ONLY, schema=schema)
super().__init__(url=MOONSTREAM_DB_V3_URI_READ_ONLY, schema=schema)
@property
def engine(self):
raise AttributeError(
"RO_engine should be used instead of engine for read-only access."
)
@property
def RO_engine(self) -> Engine:
return self._engine
@property
def RO_session_local(self):
return self._session_local
@property
def RO_yield_db_session_ctx(self):
return self._yield_db_session_ctx
def yield_db_read_only_session(self) -> Generator[Session, None, None]:
"""
Yields read-only database connection (created using environment variables).
As per FastAPI docs:
https://fastapi.tiangolo.com/tutorial/sql-databases/#create-a-dependency
"""
session = self._session_local()
try:
yield session
finally:
session.close()
class MoonstreamDBIndexesEngine(DBEngine):
def __init__(self, schema: Optional[str] = None) -> None:
super().__init__(url=MOONSTREAM_DB_V3_INDEXES_URI, schema=schema)
self._session_local = sessionmaker(bind=self.engine)
self._yield_db_session_ctx = contextmanager(self.yield_db_session)
@property
def session_local(self):
return self._session_local
@property
def yield_db_session_ctx(self):
return self._yield_db_session_ctx
def yield_db_session(
self,
) -> Generator[Session, None, None]:
"""
Yields a database connection (created using environment variables).
As per FastAPI docs:
https://fastapi.tiangolo.com/tutorial/sql-databases/#create-a-dependency
"""
session = self._session_local()
try:
yield session
finally:
session.close()
class MoonstreamDBIndexesEngineRO(DBEngine):
def __init__(self, schema: Optional[str] = None) -> None:
super().__init__(url=MOONSTREAM_DB_V3_INDEXES_URI_READ_ONLY, schema=schema)
@property
def engine(self):

Wyświetl plik

@ -501,6 +501,38 @@ class ArbitrumSepoliaLabel(EvmBasedLabel): # type: ignore
)
class Game7OrbitArbitrumSepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "game7_orbit_arbitrum_sepolia_labels"
__table_args__ = (
Index(
"ix_g7o_arbitrum_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_g7o_arbitrum_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
Index(
"uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call",
"transaction_hash",
unique=True,
postgresql_where=text("label='seer' and label_type='tx_call'"),
),
Index(
"uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt",
"transaction_hash",
"log_index",
unique=True,
postgresql_where=text("label='seer' and label_type='event'"),
),
)
class XaiLabel(EvmBasedLabel): # type: ignore
__tablename__ = "xai_labels"
@ -787,3 +819,67 @@ class StarknetSepoliaLabel(EvmBasedLabel): # type: ignore
postgresql_where=text("label='seer' and label_type='event'"),
),
)
class MantleLabel(EvmBasedLabel): # type: ignore
__tablename__ = "mantle_labels"
__table_args__ = (
Index(
"ix_mantle_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_mantle_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
Index(
"uk_mantle_labels_tx_hash_tx_call",
"transaction_hash",
unique=True,
postgresql_where=text("label='seer' and label_type='tx_call'"),
),
Index(
"uk_mantle_labels_tx_hash_log_idx_evt",
"transaction_hash",
"log_index",
unique=True,
postgresql_where=text("label='seer' and label_type='event'"),
),
)
class MantleSepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "mantle_sepolia_labels"
__table_args__ = (
Index(
"ix_mantle_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_mantle_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
Index(
"uk_mantle_sepolia_labels_tx_hash_tx_call",
"transaction_hash",
unique=True,
postgresql_where=text("label='seer' and label_type='tx_call'"),
),
Index(
"uk_mantle_sepolia_labels_tx_hash_log_idx_evt",
"transaction_hash",
"log_index",
unique=True,
postgresql_where=text("label='seer' and label_type='event'"),
),
)

Wyświetl plik

@ -122,6 +122,9 @@ class EthereumLogIndex(EvmBasedLogs):
__tablename__ = "ethereum_logs"
__table_args__ = (
Index(
"idx_ethereum_logs_address_selector", "address", "selector", unique=False
),
Index(
"idx_ethereum_logs_block_hash_log_index",
"block_hash",
@ -172,6 +175,7 @@ class PolygonLogIndex(EvmBasedLogs):
__tablename__ = "polygon_logs"
__table_args__ = (
Index("idx_polygon_logs_address_selector", "address", "selector", unique=False),
UniqueConstraint(
"transaction_hash",
"log_index",
@ -193,6 +197,367 @@ class PolygonReorgs(EvmBasedReorgs):
__tablename__ = "polygon_reorgs"
### Xai
class XaiBlockIndex(EvmBasedBlocks):
__tablename__ = "xai_blocks"
l1_block_number = Column(BigInteger, nullable=False)
class XaiTransactionIndex(EvmBasedTransactions):
__tablename__ = "xai_transactions"
block_number = Column(
BigInteger,
ForeignKey("xai_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
class XaiLogIndex(EvmBasedLogs):
__tablename__ = "xai_logs"
__table_args__ = (
Index("idx_xai_logs_address_selector", "address", "selector", unique=False),
UniqueConstraint(
"transaction_hash",
"log_index",
name="uq_xai_log_idx_tx_hash_log_idx",
),
PrimaryKeyConstraint("transaction_hash", "log_index", name="pk_xai_log_index"),
)
transaction_hash = Column(
VARCHAR(256),
ForeignKey("xai_transactions.hash", ondelete="CASCADE"),
nullable=False,
index=True,
)
class XaiReorgs(EvmBasedReorgs):
__tablename__ = "xai_reorgs"
### Xai Sepolia
class XaiSepoliaBlockIndex(EvmBasedBlocks):
__tablename__ = "xai_sepolia_blocks"
l1_block_number = Column(BigInteger, nullable=False)
class XaiSepoliaTransactionIndex(EvmBasedTransactions):
__tablename__ = "xai_sepolia_transactions"
block_number = Column(
BigInteger,
ForeignKey("xai_sepolia_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
class XaiSepoliaLogIndex(EvmBasedLogs):
__tablename__ = "xai_sepolia_logs"
__table_args__ = (
Index(
"idx_xai_sepolia_logs_address_selector", "address", "selector", unique=False
),
UniqueConstraint(
"transaction_hash",
"log_index",
name="uq_xai_sepolia_log_idx_tx_hash_log_idx",
),
PrimaryKeyConstraint(
"transaction_hash", "log_index", name="pk_xai_sepolia_log_index"
),
)
transaction_hash = Column(
VARCHAR(256),
ForeignKey("xai_sepolia_transactions.hash", ondelete="CASCADE"),
nullable=False,
index=True,
)
class XaiSepoliaReorgs(EvmBasedReorgs):
__tablename__ = "xai_sepolia_reorgs"
### Arbitrum One
class ArbitrumOneBlockIndex(EvmBasedBlocks):
__tablename__ = "arbitrum_one_blocks"
l1_block_number = Column(BigInteger, nullable=False)
class ArbitrumOneTransactionIndex(EvmBasedTransactions):
__tablename__ = "arbitrum_one_transactions"
block_number = Column(
BigInteger,
ForeignKey("arbitrum_one_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
class ArbitrumOneLogIndex(EvmBasedLogs):
__tablename__ = "arbitrum_one_logs"
__table_args__ = (
Index(
"idx_arbitrum_one_logs_address_selector",
"address",
"selector",
unique=False,
),
UniqueConstraint(
"transaction_hash",
"log_index",
name="uq_arbitrum_one_log_idx_tx_hash_log_idx",
),
PrimaryKeyConstraint(
"transaction_hash", "log_index", name="pk_arbitrum_one_log_index"
),
)
transaction_hash = Column(
VARCHAR(256),
ForeignKey("arbitrum_one_transactions.hash", ondelete="CASCADE"),
nullable=False,
index=True,
)
class ArbitrumOneReorgs(EvmBasedReorgs):
__tablename__ = "arbitrum_one_reorgs"
### Arbitrum Sepolia
class ArbitrumSepoliaBlockIndex(EvmBasedBlocks):
__tablename__ = "arbitrum_sepolia_blocks"
l1_block_number = Column(BigInteger, nullable=False)
class ArbitrumSepoliaTransactionIndex(EvmBasedTransactions):
__tablename__ = "arbitrum_sepolia_transactions"
block_number = Column(
BigInteger,
ForeignKey("arbitrum_sepolia_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
class ArbitrumSepoliaLogIndex(EvmBasedLogs):
__tablename__ = "arbitrum_sepolia_logs"
__table_args__ = (
Index(
"idx_arbitrum_sepolia_logs_address_selector",
"address",
"selector",
unique=False,
),
UniqueConstraint(
"transaction_hash",
"log_index",
name="uq_arbitrum_sepolia_log_idx_tx_hash_log_idx",
),
PrimaryKeyConstraint(
"transaction_hash", "log_index", name="pk_arbitrum_sepolia_log_index"
),
)
transaction_hash = Column(
VARCHAR(256),
ForeignKey("arbitrum_sepolia_transactions.hash", ondelete="CASCADE"),
nullable=False,
index=True,
)
class ArbitrumSepoliaReorgs(EvmBasedReorgs):
__tablename__ = "arbitrum_sepolia_reorgs"
### Game7 Orbit Arbitrum Sepolia
class Game7OrbitArbitrumSepoliaBlockIndex(EvmBasedBlocks):
__tablename__ = "game7_orbit_arbitrum_sepolia_blocks"
l1_block_number = Column(BigInteger, nullable=False)
class Game7OrbitArbitrumSepoliaTransactionIndex(EvmBasedTransactions):
__tablename__ = "game7_orbit_arbitrum_sepolia_transactions"
block_number = Column(
BigInteger,
ForeignKey(
"game7_orbit_arbitrum_sepolia_blocks.block_number", ondelete="CASCADE"
),
nullable=False,
index=True,
)
class Game7OrbitArbitrumSepoliaLogIndex(EvmBasedLogs):
__tablename__ = "game7_orbit_arbitrum_sepolia_logs"
__table_args__ = (
Index(
"idx_game7_orbit_arbitrum_sepolia_logs_address_selector",
"address",
"selector",
unique=False,
),
UniqueConstraint(
"transaction_hash",
"log_index",
name="uq_g7o_arbitrum_sepolia_log_idx_tx_hash_log_idx",
),
PrimaryKeyConstraint(
"transaction_hash",
"log_index",
name="pk_game7_orbit_arbitrum_sepolia_log_index",
),
)
transaction_hash = Column(
VARCHAR(256),
ForeignKey(
"game7_orbit_arbitrum_sepolia_transactions.hash", ondelete="CASCADE"
),
nullable=False,
index=True,
)
class Game7OrbitArbitrumSepoliaReorgs(EvmBasedReorgs):
__tablename__ = "game7_orbit_arbitrum_sepolia_reorgs"
### Mantle
class MantleBlockIndex(EvmBasedBlocks):
__tablename__ = "mantle_blocks"
class MantleTransactionIndex(EvmBasedTransactions):
__tablename__ = "mantle_transactions"
block_number = Column(
BigInteger,
ForeignKey("mantle_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
class MantleLogIndex(EvmBasedLogs):
__tablename__ = "mantle_logs"
__table_args__ = (
Index("idx_mantle_logs_address_selector", "address", "selector", unique=False),
Index(
"idx_mantle_logs_block_hash_log_index",
"block_hash",
"log_index",
unique=True,
),
UniqueConstraint(
"transaction_hash",
"log_index",
name="uq_mantle_log_index_transaction_hash_log_index",
),
PrimaryKeyConstraint(
"transaction_hash", "log_index", name="pk_mantle_log_index"
),
)
transaction_hash = Column(
VARCHAR(256),
ForeignKey("mantle_transactions.hash", ondelete="CASCADE"),
nullable=False,
index=True,
)
class MantleReorgs(EvmBasedReorgs):
__tablename__ = "mantle_reorgs"
### Mantle Sepolia
class MantleSepoliaBlockIndex(EvmBasedBlocks):
__tablename__ = "mantle_sepolia_blocks"
class MantleSepoliaTransactionIndex(EvmBasedTransactions):
__tablename__ = "mantle_sepolia_transactions"
block_number = Column(
BigInteger,
ForeignKey("mantle_sepolia_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
class MantleSepoliaLogIndex(EvmBasedLogs):
__tablename__ = "mantle_sepolia_logs"
__table_args__ = (
Index(
"idx_mantle_sepolia_logs_address_selector",
"address",
"selector",
unique=False,
),
Index(
"idx_mantle_sepolia_logs_block_hash_log_index",
"block_hash",
"log_index",
unique=True,
),
UniqueConstraint(
"transaction_hash",
"log_index",
name="uq_mantle_sepolia_log_index_transaction_hash_log_index",
),
PrimaryKeyConstraint(
"transaction_hash", "log_index", name="pk_mantle_sepolia_log_index"
),
)
transaction_hash = Column(
VARCHAR(256),
ForeignKey("mantle_sepolia_transactions.hash", ondelete="CASCADE"),
nullable=False,
index=True,
)
class MantleSepoliaReorgs(EvmBasedReorgs):
__tablename__ = "mantle_sepolia_reorgs"
### ABI Jobs

Wyświetl plik

@ -1 +1 @@
0.0.7
0.0.8