kopia lustrzana https://github.com/bugout-dev/moonstream
Merge pull request #1037 from moonstream-to/db-avalanche-zk-era-sepolia
Models for Avalanche and zk era sepolia blockchainspull/1038/head moonstreamdb/v0.3.9
commit
e8051972f0
|
@ -25,6 +25,18 @@ target_metadata = MoonstreamBase.metadata
|
|||
# my_important_option = config.get_main_option("my_important_option")
|
||||
# ... etc.
|
||||
from moonstreamdb.models import (
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumSepoliaBlock,
|
||||
ArbitrumSepoliaLabel,
|
||||
ArbitrumSepoliaTransaction,
|
||||
AvalancheBlock,
|
||||
AvalancheFujiBlock,
|
||||
AvalancheFujiLabel,
|
||||
AvalancheFujiTransaction,
|
||||
AvalancheLabel,
|
||||
AvalancheTransaction,
|
||||
ESDEventSignature,
|
||||
ESDFunctionSignature,
|
||||
EthereumBlock,
|
||||
|
@ -40,21 +52,21 @@ from moonstreamdb.models import (
|
|||
WyrmBlock,
|
||||
WyrmLabel,
|
||||
WyrmTransaction,
|
||||
XDaiBlock,
|
||||
XDaiLabel,
|
||||
XDaiTransaction,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumSepoliaBlock,
|
||||
ArbitrumSepoliaTransaction,
|
||||
ArbitrumSepoliaLabel,
|
||||
XaiBlock,
|
||||
XaiLabel,
|
||||
XaiTransaction,
|
||||
XDaiBlock,
|
||||
XDaiLabel,
|
||||
XDaiTransaction,
|
||||
ZkSyncEraBlock,
|
||||
ZkSyncEraLabel,
|
||||
ZkSyncEraSepoliaBlock,
|
||||
ZkSyncEraSepoliaLabel,
|
||||
ZkSyncEraSepoliaTransaction,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraTransaction,
|
||||
)
|
||||
|
||||
|
||||
|
@ -81,6 +93,12 @@ def include_symbol(tablename, schema):
|
|||
ZkSyncEraTestnetBlock.__tablename__,
|
||||
ZkSyncEraTestnetLabel.__tablename__,
|
||||
ZkSyncEraTestnetTransaction.__tablename__,
|
||||
ZkSyncEraBlock.__tablename__,
|
||||
ZkSyncEraLabel.__tablename__,
|
||||
ZkSyncEraTransaction.__tablename__,
|
||||
ZkSyncEraSepoliaBlock.__tablename__,
|
||||
ZkSyncEraSepoliaLabel.__tablename__,
|
||||
ZkSyncEraSepoliaTransaction.__tablename__,
|
||||
ArbitrumNovaBlock.__tablename__,
|
||||
ArbitrumNovaTransaction.__tablename__,
|
||||
ArbitrumNovaLabel.__tablename__,
|
||||
|
@ -90,6 +108,12 @@ def include_symbol(tablename, schema):
|
|||
XaiBlock.__tablename__,
|
||||
XaiLabel.__tablename__,
|
||||
XaiTransaction.__tablename__,
|
||||
AvalancheBlock.__tablename__,
|
||||
AvalancheFujiBlock.__tablename__,
|
||||
AvalancheFujiLabel.__tablename__,
|
||||
AvalancheFujiTransaction.__tablename__,
|
||||
AvalancheLabel.__tablename__,
|
||||
AvalancheTransaction.__tablename__,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,331 @@
|
|||
"""Avalanche and Zksync Era Sepolia blockchains
|
||||
|
||||
Revision ID: a95cbab56a0b
|
||||
Revises: a99b97acc39e
|
||||
Create Date: 2024-03-28 11:08:06.677075
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a95cbab56a0b'
|
||||
down_revision = 'a99b97acc39e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('avalanche_blocks',
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=False),
|
||||
sa.Column('difficulty', sa.BigInteger(), nullable=True),
|
||||
sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True),
|
||||
sa.Column('gas_limit', sa.BigInteger(), nullable=True),
|
||||
sa.Column('gas_used', sa.BigInteger(), nullable=True),
|
||||
sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True),
|
||||
sa.Column('miner', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('uncles', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('size', sa.Integer(), nullable=True),
|
||||
sa.Column('state_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('timestamp', sa.BigInteger(), nullable=True),
|
||||
sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('block_extra_data', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('block_gas_cost', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('ext_data_gas_used', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('ext_data_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.PrimaryKeyConstraint('block_number', name=op.f('pk_avalanche_blocks'))
|
||||
)
|
||||
op.create_index(op.f('ix_avalanche_blocks_block_number'), 'avalanche_blocks', ['block_number'], unique=True)
|
||||
op.create_index(op.f('ix_avalanche_blocks_hash'), 'avalanche_blocks', ['hash'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_blocks_timestamp'), 'avalanche_blocks', ['timestamp'], unique=False)
|
||||
op.create_table('avalanche_fuji_blocks',
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=False),
|
||||
sa.Column('difficulty', sa.BigInteger(), nullable=True),
|
||||
sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True),
|
||||
sa.Column('gas_limit', sa.BigInteger(), nullable=True),
|
||||
sa.Column('gas_used', sa.BigInteger(), nullable=True),
|
||||
sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True),
|
||||
sa.Column('miner', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('uncles', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('size', sa.Integer(), nullable=True),
|
||||
sa.Column('state_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('timestamp', sa.BigInteger(), nullable=True),
|
||||
sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('block_extra_data', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('block_gas_cost', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('ext_data_gas_used', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('ext_data_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.PrimaryKeyConstraint('block_number', name=op.f('pk_avalanche_fuji_blocks'))
|
||||
)
|
||||
op.create_index(op.f('ix_avalanche_fuji_blocks_block_number'), 'avalanche_fuji_blocks', ['block_number'], unique=True)
|
||||
op.create_index(op.f('ix_avalanche_fuji_blocks_hash'), 'avalanche_fuji_blocks', ['hash'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_blocks_timestamp'), 'avalanche_fuji_blocks', ['timestamp'], unique=False)
|
||||
op.create_table('avalanche_fuji_labels',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=True),
|
||||
sa.Column('address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||
sa.Column('block_timestamp', sa.BigInteger(), nullable=True),
|
||||
sa.Column('log_index', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_avalanche_fuji_labels')),
|
||||
sa.UniqueConstraint('id', name=op.f('uq_avalanche_fuji_labels_id'))
|
||||
)
|
||||
op.create_index(op.f('ix_avalanche_fuji_labels_address'), 'avalanche_fuji_labels', ['address'], unique=False)
|
||||
op.create_index('ix_avalanche_fuji_labels_address_block_number', 'avalanche_fuji_labels', ['address', 'block_number'], unique=False)
|
||||
op.create_index('ix_avalanche_fuji_labels_address_block_timestamp', 'avalanche_fuji_labels', ['address', 'block_timestamp'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_labels_block_number'), 'avalanche_fuji_labels', ['block_number'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_labels_block_timestamp'), 'avalanche_fuji_labels', ['block_timestamp'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_labels_label'), 'avalanche_fuji_labels', ['label'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_labels_transaction_hash'), 'avalanche_fuji_labels', ['transaction_hash'], unique=False)
|
||||
op.create_table('avalanche_labels',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=True),
|
||||
sa.Column('address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||
sa.Column('block_timestamp', sa.BigInteger(), nullable=True),
|
||||
sa.Column('log_index', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_avalanche_labels')),
|
||||
sa.UniqueConstraint('id', name=op.f('uq_avalanche_labels_id'))
|
||||
)
|
||||
op.create_index(op.f('ix_avalanche_labels_address'), 'avalanche_labels', ['address'], unique=False)
|
||||
op.create_index('ix_avalanche_labels_address_block_number', 'avalanche_labels', ['address', 'block_number'], unique=False)
|
||||
op.create_index('ix_avalanche_labels_address_block_timestamp', 'avalanche_labels', ['address', 'block_timestamp'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_labels_block_number'), 'avalanche_labels', ['block_number'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_labels_block_timestamp'), 'avalanche_labels', ['block_timestamp'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_labels_label'), 'avalanche_labels', ['label'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_labels_transaction_hash'), 'avalanche_labels', ['transaction_hash'], unique=False)
|
||||
op.create_table('zksync_era_sepolia_blocks',
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=False),
|
||||
sa.Column('difficulty', sa.BigInteger(), nullable=True),
|
||||
sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True),
|
||||
sa.Column('gas_limit', sa.BigInteger(), nullable=True),
|
||||
sa.Column('gas_used', sa.BigInteger(), nullable=True),
|
||||
sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True),
|
||||
sa.Column('miner', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('uncles', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('size', sa.Integer(), nullable=True),
|
||||
sa.Column('state_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('timestamp', sa.BigInteger(), nullable=True),
|
||||
sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('sha3_uncles', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('l1_batch_number', sa.BigInteger(), nullable=True),
|
||||
sa.Column('l1_batch_timestamp', sa.BigInteger(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('block_number', name=op.f('pk_zksync_era_sepolia_blocks'))
|
||||
)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_blocks_block_number'), 'zksync_era_sepolia_blocks', ['block_number'], unique=True)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_blocks_hash'), 'zksync_era_sepolia_blocks', ['hash'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_blocks_timestamp'), 'zksync_era_sepolia_blocks', ['timestamp'], unique=False)
|
||||
op.create_table('zksync_era_sepolia_labels',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=True),
|
||||
sa.Column('address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||
sa.Column('block_timestamp', sa.BigInteger(), nullable=True),
|
||||
sa.Column('log_index', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_zksync_era_sepolia_labels')),
|
||||
sa.UniqueConstraint('id', name=op.f('uq_zksync_era_sepolia_labels_id'))
|
||||
)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_labels_address'), 'zksync_era_sepolia_labels', ['address'], unique=False)
|
||||
op.create_index('ix_zksync_era_sepolia_labels_address_block_number', 'zksync_era_sepolia_labels', ['address', 'block_number'], unique=False)
|
||||
op.create_index('ix_zksync_era_sepolia_labels_address_block_timestamp', 'zksync_era_sepolia_labels', ['address', 'block_timestamp'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_labels_block_number'), 'zksync_era_sepolia_labels', ['block_number'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_labels_block_timestamp'), 'zksync_era_sepolia_labels', ['block_timestamp'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_labels_label'), 'zksync_era_sepolia_labels', ['label'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_labels_transaction_hash'), 'zksync_era_sepolia_labels', ['transaction_hash'], unique=False)
|
||||
op.create_table('avalanche_fuji_transactions',
|
||||
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=False),
|
||||
sa.Column('from_address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('to_address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('input', sa.Text(), nullable=True),
|
||||
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transaction_index', sa.BigInteger(), nullable=True),
|
||||
sa.Column('transaction_type', sa.Integer(), nullable=True),
|
||||
sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.ForeignKeyConstraint(['block_number'], ['avalanche_fuji_blocks.block_number'], name=op.f('fk_avalanche_fuji_transactions_block_number_avalanche_fuji_blocks'), ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('hash', name=op.f('pk_avalanche_fuji_transactions'))
|
||||
)
|
||||
op.create_index(op.f('ix_avalanche_fuji_transactions_block_number'), 'avalanche_fuji_transactions', ['block_number'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_transactions_from_address'), 'avalanche_fuji_transactions', ['from_address'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_transactions_gas'), 'avalanche_fuji_transactions', ['gas'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_transactions_gas_price'), 'avalanche_fuji_transactions', ['gas_price'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_transactions_hash'), 'avalanche_fuji_transactions', ['hash'], unique=True)
|
||||
op.create_index(op.f('ix_avalanche_fuji_transactions_to_address'), 'avalanche_fuji_transactions', ['to_address'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_fuji_transactions_value'), 'avalanche_fuji_transactions', ['value'], unique=False)
|
||||
op.create_table('avalanche_transactions',
|
||||
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=False),
|
||||
sa.Column('from_address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('to_address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('input', sa.Text(), nullable=True),
|
||||
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transaction_index', sa.BigInteger(), nullable=True),
|
||||
sa.Column('transaction_type', sa.Integer(), nullable=True),
|
||||
sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.ForeignKeyConstraint(['block_number'], ['avalanche_blocks.block_number'], name=op.f('fk_avalanche_transactions_block_number_avalanche_blocks'), ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('hash', name=op.f('pk_avalanche_transactions'))
|
||||
)
|
||||
op.create_index(op.f('ix_avalanche_transactions_block_number'), 'avalanche_transactions', ['block_number'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_transactions_from_address'), 'avalanche_transactions', ['from_address'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_transactions_gas'), 'avalanche_transactions', ['gas'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_transactions_gas_price'), 'avalanche_transactions', ['gas_price'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_transactions_hash'), 'avalanche_transactions', ['hash'], unique=True)
|
||||
op.create_index(op.f('ix_avalanche_transactions_to_address'), 'avalanche_transactions', ['to_address'], unique=False)
|
||||
op.create_index(op.f('ix_avalanche_transactions_value'), 'avalanche_transactions', ['value'], unique=False)
|
||||
op.create_table('zksync_era_sepolia_transactions',
|
||||
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
|
||||
sa.Column('block_number', sa.BigInteger(), nullable=False),
|
||||
sa.Column('from_address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('to_address', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('input', sa.Text(), nullable=True),
|
||||
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('transaction_index', sa.BigInteger(), nullable=True),
|
||||
sa.Column('transaction_type', sa.Integer(), nullable=True),
|
||||
sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True),
|
||||
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.Column('l1_batch_number', sa.BigInteger(), nullable=True),
|
||||
sa.Column('l1_batch_tx_index', sa.BigInteger(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['block_number'], ['zksync_era_sepolia_blocks.block_number'], name=op.f('fk_zksync_era_sepolia_transactions_block_number_zksync_era_sepolia_blocks'), ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('hash', name=op.f('pk_zksync_era_sepolia_transactions'))
|
||||
)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_transactions_block_number'), 'zksync_era_sepolia_transactions', ['block_number'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_transactions_from_address'), 'zksync_era_sepolia_transactions', ['from_address'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_transactions_gas'), 'zksync_era_sepolia_transactions', ['gas'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_transactions_gas_price'), 'zksync_era_sepolia_transactions', ['gas_price'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_transactions_hash'), 'zksync_era_sepolia_transactions', ['hash'], unique=True)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_transactions_to_address'), 'zksync_era_sepolia_transactions', ['to_address'], unique=False)
|
||||
op.create_index(op.f('ix_zksync_era_sepolia_transactions_value'), 'zksync_era_sepolia_transactions', ['value'], unique=False)
|
||||
op.create_index('ix_arbitrum_nova_labels_address_block_number', 'arbitrum_nova_labels', ['address', 'block_number'], unique=False)
|
||||
op.create_index('ix_arbitrum_nova_labels_address_block_timestamp', 'arbitrum_nova_labels', ['address', 'block_timestamp'], unique=False)
|
||||
op.create_index('ix_arbitrum_sepolia_labels_address_block_number', 'arbitrum_sepolia_labels', ['address', 'block_number'], unique=False)
|
||||
op.create_index('ix_arbitrum_sepolia_labels_address_block_timestamp', 'arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False)
|
||||
op.create_unique_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(op.f('uq_zksync_era_testnet_labels_id'), 'zksync_era_testnet_labels', type_='unique')
|
||||
op.drop_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', type_='unique')
|
||||
op.drop_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', type_='unique')
|
||||
op.drop_constraint(op.f('uq_xai_labels_id'), 'xai_labels', type_='unique')
|
||||
op.drop_constraint(op.f('uq_wyrm_labels_id'), 'wyrm_labels', type_='unique')
|
||||
op.drop_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', type_='unique')
|
||||
op.drop_constraint(op.f('uq_opensea_crawler_state_id'), 'opensea_crawler_state', type_='unique')
|
||||
op.drop_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', type_='unique')
|
||||
op.create_index('idx_ethereum_labels_opensea_nft_name', 'ethereum_labels', [sa.text("(label_data ->> 'name'::text)")], unique=False)
|
||||
op.drop_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', type_='unique')
|
||||
op.drop_index('ix_arbitrum_sepolia_labels_address_block_timestamp', table_name='arbitrum_sepolia_labels')
|
||||
op.drop_index('ix_arbitrum_sepolia_labels_address_block_number', table_name='arbitrum_sepolia_labels')
|
||||
op.drop_index('ix_arbitrum_nova_labels_address_block_timestamp', table_name='arbitrum_nova_labels')
|
||||
op.drop_index('ix_arbitrum_nova_labels_address_block_number', table_name='arbitrum_nova_labels')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_transactions_value'), table_name='zksync_era_sepolia_transactions')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_transactions_to_address'), table_name='zksync_era_sepolia_transactions')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_transactions_hash'), table_name='zksync_era_sepolia_transactions')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_transactions_gas_price'), table_name='zksync_era_sepolia_transactions')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_transactions_gas'), table_name='zksync_era_sepolia_transactions')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_transactions_from_address'), table_name='zksync_era_sepolia_transactions')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_transactions_block_number'), table_name='zksync_era_sepolia_transactions')
|
||||
op.drop_table('zksync_era_sepolia_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_transactions_value'), table_name='avalanche_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_transactions_to_address'), table_name='avalanche_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_transactions_hash'), table_name='avalanche_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_transactions_gas_price'), table_name='avalanche_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_transactions_gas'), table_name='avalanche_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_transactions_from_address'), table_name='avalanche_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_transactions_block_number'), table_name='avalanche_transactions')
|
||||
op.drop_table('avalanche_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_transactions_value'), table_name='avalanche_fuji_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_transactions_to_address'), table_name='avalanche_fuji_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_transactions_hash'), table_name='avalanche_fuji_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_transactions_gas_price'), table_name='avalanche_fuji_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_transactions_gas'), table_name='avalanche_fuji_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_transactions_from_address'), table_name='avalanche_fuji_transactions')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_transactions_block_number'), table_name='avalanche_fuji_transactions')
|
||||
op.drop_table('avalanche_fuji_transactions')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_labels_transaction_hash'), table_name='zksync_era_sepolia_labels')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_labels_label'), table_name='zksync_era_sepolia_labels')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_labels_block_timestamp'), table_name='zksync_era_sepolia_labels')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_labels_block_number'), table_name='zksync_era_sepolia_labels')
|
||||
op.drop_index('ix_zksync_era_sepolia_labels_address_block_timestamp', table_name='zksync_era_sepolia_labels')
|
||||
op.drop_index('ix_zksync_era_sepolia_labels_address_block_number', table_name='zksync_era_sepolia_labels')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_labels_address'), table_name='zksync_era_sepolia_labels')
|
||||
op.drop_table('zksync_era_sepolia_labels')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_blocks_timestamp'), table_name='zksync_era_sepolia_blocks')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_blocks_hash'), table_name='zksync_era_sepolia_blocks')
|
||||
op.drop_index(op.f('ix_zksync_era_sepolia_blocks_block_number'), table_name='zksync_era_sepolia_blocks')
|
||||
op.drop_table('zksync_era_sepolia_blocks')
|
||||
op.drop_index(op.f('ix_avalanche_labels_transaction_hash'), table_name='avalanche_labels')
|
||||
op.drop_index(op.f('ix_avalanche_labels_label'), table_name='avalanche_labels')
|
||||
op.drop_index(op.f('ix_avalanche_labels_block_timestamp'), table_name='avalanche_labels')
|
||||
op.drop_index(op.f('ix_avalanche_labels_block_number'), table_name='avalanche_labels')
|
||||
op.drop_index('ix_avalanche_labels_address_block_timestamp', table_name='avalanche_labels')
|
||||
op.drop_index('ix_avalanche_labels_address_block_number', table_name='avalanche_labels')
|
||||
op.drop_index(op.f('ix_avalanche_labels_address'), table_name='avalanche_labels')
|
||||
op.drop_table('avalanche_labels')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_labels_transaction_hash'), table_name='avalanche_fuji_labels')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_labels_label'), table_name='avalanche_fuji_labels')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_labels_block_timestamp'), table_name='avalanche_fuji_labels')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_labels_block_number'), table_name='avalanche_fuji_labels')
|
||||
op.drop_index('ix_avalanche_fuji_labels_address_block_timestamp', table_name='avalanche_fuji_labels')
|
||||
op.drop_index('ix_avalanche_fuji_labels_address_block_number', table_name='avalanche_fuji_labels')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_labels_address'), table_name='avalanche_fuji_labels')
|
||||
op.drop_table('avalanche_fuji_labels')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_blocks_timestamp'), table_name='avalanche_fuji_blocks')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_blocks_hash'), table_name='avalanche_fuji_blocks')
|
||||
op.drop_index(op.f('ix_avalanche_fuji_blocks_block_number'), table_name='avalanche_fuji_blocks')
|
||||
op.drop_table('avalanche_fuji_blocks')
|
||||
op.drop_index(op.f('ix_avalanche_blocks_timestamp'), table_name='avalanche_blocks')
|
||||
op.drop_index(op.f('ix_avalanche_blocks_hash'), table_name='avalanche_blocks')
|
||||
op.drop_index(op.f('ix_avalanche_blocks_block_number'), table_name='avalanche_blocks')
|
||||
op.drop_table('avalanche_blocks')
|
||||
# ### end Alembic commands ###
|
|
@ -2,6 +2,18 @@ from enum import Enum
|
|||
from typing import Type, Union
|
||||
|
||||
from .models import (
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumSepoliaBlock,
|
||||
ArbitrumSepoliaLabel,
|
||||
ArbitrumSepoliaTransaction,
|
||||
AvalancheBlock,
|
||||
AvalancheFujiBlock,
|
||||
AvalancheFujiLabel,
|
||||
AvalancheFujiTransaction,
|
||||
AvalancheLabel,
|
||||
AvalancheTransaction,
|
||||
EthereumBlock,
|
||||
EthereumLabel,
|
||||
EthereumTransaction,
|
||||
|
@ -14,24 +26,21 @@ from .models import (
|
|||
WyrmBlock,
|
||||
WyrmLabel,
|
||||
WyrmTransaction,
|
||||
XDaiBlock,
|
||||
XDaiLabel,
|
||||
XDaiTransaction,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraBlock,
|
||||
ZkSyncEraLabel,
|
||||
ZkSyncEraTransaction,
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumSepoliaBlock,
|
||||
ArbitrumSepoliaTransaction,
|
||||
ArbitrumSepoliaLabel,
|
||||
XaiBlock,
|
||||
XaiLabel,
|
||||
XaiTransaction,
|
||||
XDaiBlock,
|
||||
XDaiLabel,
|
||||
XDaiTransaction,
|
||||
ZkSyncEraBlock,
|
||||
ZkSyncEraLabel,
|
||||
ZkSyncEraSepoliaBlock,
|
||||
ZkSyncEraSepoliaLabel,
|
||||
ZkSyncEraSepoliaTransaction,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraTransaction,
|
||||
)
|
||||
|
||||
|
||||
|
@ -41,11 +50,14 @@ class AvailableBlockchainType(Enum):
|
|||
MUMBAI = "mumbai"
|
||||
XDAI = "xdai"
|
||||
WYRM = "wyrm"
|
||||
ZKSYNC_ERA_TESTNET = "zksync_era_testnet"
|
||||
ZKSYNC_ERA = "zksync_era"
|
||||
ZKSYNC_ERA_TESTNET = "zksync_era_testnet"
|
||||
ZKSYNC_ERA_SEPOLIA = "zksync_era_sepolia"
|
||||
ARBITRUM_NOVA = "arbitrum_nova"
|
||||
ARBITRUM_SEPOLIA = "arbitrum_sepolia"
|
||||
XAI = "xai"
|
||||
AVALANCHE = "avalanche"
|
||||
AVALANCHE_FUJI = "avalanche_fuji"
|
||||
|
||||
|
||||
def get_block_model(
|
||||
|
@ -59,9 +71,12 @@ def get_block_model(
|
|||
WyrmBlock,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraBlock,
|
||||
ZkSyncEraSepoliaBlock,
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumSepoliaBlock,
|
||||
XaiBlock,
|
||||
AvalancheBlock,
|
||||
AvalancheFujiBlock,
|
||||
]
|
||||
]:
|
||||
"""
|
||||
|
@ -77,9 +92,12 @@ def get_block_model(
|
|||
WyrmBlock,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraBlock,
|
||||
ZkSyncEraSepoliaBlock,
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumSepoliaBlock,
|
||||
XaiBlock,
|
||||
AvalancheBlock,
|
||||
AvalancheFujiBlock,
|
||||
]
|
||||
]
|
||||
if blockchain_type == AvailableBlockchainType.ETHEREUM:
|
||||
|
@ -96,12 +114,18 @@ def get_block_model(
|
|||
block_model = ZkSyncEraTestnetBlock
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
|
||||
block_model = ZkSyncEraBlock
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
|
||||
block_model = ZkSyncEraSepoliaBlock
|
||||
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
|
||||
block_model = ArbitrumNovaBlock
|
||||
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
|
||||
block_model = ArbitrumSepoliaBlock
|
||||
elif blockchain_type == AvailableBlockchainType.XAI:
|
||||
block_model = XaiBlock
|
||||
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
|
||||
block_model = AvalancheBlock
|
||||
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
|
||||
block_model = AvalancheFujiBlock
|
||||
else:
|
||||
raise Exception("Unsupported blockchain type provided")
|
||||
|
||||
|
@ -119,9 +143,12 @@ def get_label_model(
|
|||
WyrmLabel,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraLabel,
|
||||
ZkSyncEraSepoliaLabel,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumSepoliaLabel,
|
||||
XaiLabel,
|
||||
AvalancheLabel,
|
||||
AvalancheFujiLabel,
|
||||
]
|
||||
]:
|
||||
"""
|
||||
|
@ -137,9 +164,12 @@ def get_label_model(
|
|||
WyrmLabel,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraLabel,
|
||||
ZkSyncEraSepoliaLabel,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumSepoliaLabel,
|
||||
XaiLabel,
|
||||
AvalancheLabel,
|
||||
AvalancheFujiLabel,
|
||||
]
|
||||
]
|
||||
if blockchain_type == AvailableBlockchainType.ETHEREUM:
|
||||
|
@ -156,12 +186,19 @@ def get_label_model(
|
|||
label_model = ZkSyncEraTestnetLabel
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
|
||||
label_model = ZkSyncEraLabel
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
|
||||
label_model = ZkSyncEraSepoliaLabel
|
||||
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
|
||||
label_model = ArbitrumNovaLabel
|
||||
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
|
||||
label_model = ArbitrumSepoliaLabel
|
||||
elif blockchain_type == AvailableBlockchainType.XAI:
|
||||
label_model = XaiLabel
|
||||
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
|
||||
label_model = AvalancheLabel
|
||||
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
|
||||
label_model = AvalancheFujiLabel
|
||||
|
||||
else:
|
||||
raise Exception("Unsupported blockchain type provided")
|
||||
|
||||
|
@ -179,9 +216,12 @@ def get_transaction_model(
|
|||
WyrmTransaction,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraTransaction,
|
||||
ZkSyncEraSepoliaTransaction,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumSepoliaTransaction,
|
||||
XaiTransaction,
|
||||
AvalancheTransaction,
|
||||
AvalancheFujiTransaction,
|
||||
]
|
||||
]:
|
||||
"""
|
||||
|
@ -197,9 +237,12 @@ def get_transaction_model(
|
|||
WyrmTransaction,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraTransaction,
|
||||
ZkSyncEraSepoliaTransaction,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumSepoliaTransaction,
|
||||
XaiTransaction,
|
||||
AvalancheTransaction,
|
||||
AvalancheFujiTransaction,
|
||||
]
|
||||
]
|
||||
if blockchain_type == AvailableBlockchainType.ETHEREUM:
|
||||
|
@ -216,12 +259,18 @@ def get_transaction_model(
|
|||
transaction_model = ZkSyncEraTestnetTransaction
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
|
||||
transaction_model = ZkSyncEraTransaction
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
|
||||
transaction_model = ZkSyncEraSepoliaTransaction
|
||||
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
|
||||
transaction_model = ArbitrumNovaTransaction
|
||||
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
|
||||
transaction_model = ArbitrumSepoliaTransaction
|
||||
elif blockchain_type == AvailableBlockchainType.XAI:
|
||||
transaction_model = XaiTransaction
|
||||
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
|
||||
transaction_model = AvalancheTransaction
|
||||
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
|
||||
transaction_model = AvalancheFujiTransaction
|
||||
else:
|
||||
raise Exception("Unsupported blockchain type provided")
|
||||
|
||||
|
|
|
@ -801,6 +801,122 @@ class ZkSyncEraTestnetLabel(Base): # type: ignore
|
|||
)
|
||||
|
||||
|
||||
class ZkSyncEraSepoliaBlock(Base): # type: ignore
|
||||
__tablename__ = "zksync_era_sepolia_blocks"
|
||||
|
||||
block_number = Column(
|
||||
BigInteger, primary_key=True, unique=True, nullable=False, index=True
|
||||
)
|
||||
difficulty = Column(BigInteger)
|
||||
extra_data = Column(VARCHAR(128))
|
||||
gas_limit = Column(BigInteger)
|
||||
gas_used = Column(BigInteger)
|
||||
base_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
hash = Column(VARCHAR(256), index=True)
|
||||
logs_bloom = Column(VARCHAR(1024))
|
||||
miner = Column(VARCHAR(256))
|
||||
nonce = Column(VARCHAR(256))
|
||||
parent_hash = Column(VARCHAR(256))
|
||||
receipt_root = Column(VARCHAR(256))
|
||||
uncles = Column(VARCHAR(256))
|
||||
size = Column(Integer)
|
||||
state_root = Column(VARCHAR(256))
|
||||
timestamp = Column(BigInteger, index=True)
|
||||
total_difficulty = Column(VARCHAR(256))
|
||||
transactions_root = Column(VARCHAR(256))
|
||||
|
||||
indexed_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
mix_hash = Column(VARCHAR(256), nullable=True)
|
||||
sha3_uncles = Column(VARCHAR(256), nullable=True)
|
||||
|
||||
l1_batch_number = Column(BigInteger, nullable=True)
|
||||
l1_batch_timestamp = Column(BigInteger, nullable=True)
|
||||
|
||||
|
||||
class ZkSyncEraSepoliaTransaction(Base): # type: ignore
|
||||
__tablename__ = "zksync_era_sepolia_transactions"
|
||||
|
||||
hash = Column(
|
||||
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
|
||||
)
|
||||
block_number = Column(
|
||||
BigInteger,
|
||||
ForeignKey("zksync_era_sepolia_blocks.block_number", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
from_address = Column(VARCHAR(256), index=True)
|
||||
to_address = Column(VARCHAR(256), index=True)
|
||||
gas = Column(Numeric(precision=78, scale=0), index=True)
|
||||
gas_price = Column(Numeric(precision=78, scale=0), index=True)
|
||||
max_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
max_priority_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
input = Column(Text)
|
||||
nonce = Column(VARCHAR(256))
|
||||
transaction_index = Column(BigInteger)
|
||||
transaction_type = Column(Integer, nullable=True)
|
||||
value = Column(Numeric(precision=78, scale=0), index=True)
|
||||
|
||||
indexed_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
l1_batch_number = Column(BigInteger, nullable=True)
|
||||
l1_batch_tx_index = Column(BigInteger, nullable=True)
|
||||
|
||||
|
||||
class ZkSyncEraSepoliaLabel(Base): # type: ignore
|
||||
__tablename__ = "zksync_era_sepolia_labels"
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"ix_zksync_era_sepolia_labels_address_block_number",
|
||||
"address",
|
||||
"block_number",
|
||||
unique=False,
|
||||
),
|
||||
Index(
|
||||
"ix_zksync_era_sepolia_labels_address_block_timestamp",
|
||||
"address",
|
||||
"block_timestamp",
|
||||
unique=False,
|
||||
),
|
||||
)
|
||||
|
||||
id = Column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
default=uuid.uuid4,
|
||||
unique=True,
|
||||
nullable=False,
|
||||
)
|
||||
label = Column(VARCHAR(256), nullable=False, index=True)
|
||||
block_number = Column(
|
||||
BigInteger,
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
address = Column(
|
||||
VARCHAR(256),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
transaction_hash = Column(
|
||||
VARCHAR(256),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
label_data = Column(JSONB, nullable=True)
|
||||
block_timestamp = Column(BigInteger, index=True)
|
||||
log_index = Column(Integer, nullable=True)
|
||||
created_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class ArbitrumNovaBlock(Base): # type: ignore
|
||||
__tablename__ = "arbitrum_nova_blocks"
|
||||
|
||||
|
@ -870,6 +986,21 @@ class ArbitrumNovaTransaction(Base): # type: ignore
|
|||
class ArbitrumNovaLabel(Base): # type: ignore
|
||||
__tablename__ = "arbitrum_nova_labels"
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"ix_arbitrum_nova_labels_address_block_number",
|
||||
"address",
|
||||
"block_number",
|
||||
unique=False,
|
||||
),
|
||||
Index(
|
||||
"ix_arbitrum_nova_labels_address_block_timestamp",
|
||||
"address",
|
||||
"block_timestamp",
|
||||
unique=False,
|
||||
),
|
||||
)
|
||||
|
||||
id = Column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
|
@ -970,6 +1101,21 @@ class ArbitrumSepoliaTransaction(Base): # type: ignore
|
|||
class ArbitrumSepoliaLabel(Base): # type: ignore
|
||||
__tablename__ = "arbitrum_sepolia_labels"
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"ix_arbitrum_sepolia_labels_address_block_number",
|
||||
"address",
|
||||
"block_number",
|
||||
unique=False,
|
||||
),
|
||||
Index(
|
||||
"ix_arbitrum_sepolia_labels_address_block_timestamp",
|
||||
"address",
|
||||
"block_timestamp",
|
||||
unique=False,
|
||||
),
|
||||
)
|
||||
|
||||
id = Column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
|
@ -1101,6 +1247,232 @@ class XaiLabel(Base): # type: ignore
|
|||
)
|
||||
|
||||
|
||||
class AvalancheBlock(Base): # type: ignore
|
||||
__tablename__ = "avalanche_blocks"
|
||||
|
||||
block_number = Column(
|
||||
BigInteger, primary_key=True, unique=True, nullable=False, index=True
|
||||
)
|
||||
difficulty = Column(BigInteger)
|
||||
extra_data = Column(VARCHAR(128))
|
||||
gas_limit = Column(BigInteger)
|
||||
gas_used = Column(BigInteger)
|
||||
base_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
hash = Column(VARCHAR(256), index=True)
|
||||
logs_bloom = Column(VARCHAR(1024))
|
||||
miner = Column(VARCHAR(256))
|
||||
nonce = Column(VARCHAR(256))
|
||||
parent_hash = Column(VARCHAR(256))
|
||||
receipt_root = Column(VARCHAR(256))
|
||||
uncles = Column(VARCHAR(256))
|
||||
size = Column(Integer)
|
||||
state_root = Column(VARCHAR(256))
|
||||
timestamp = Column(BigInteger, index=True)
|
||||
total_difficulty = Column(VARCHAR(256))
|
||||
transactions_root = Column(VARCHAR(256))
|
||||
|
||||
indexed_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
mix_hash = Column(VARCHAR(256), nullable=True)
|
||||
block_extra_data = Column(VARCHAR(256), nullable=True)
|
||||
block_gas_cost = Column(VARCHAR(256), nullable=True)
|
||||
ext_data_gas_used = Column(VARCHAR(256), nullable=True)
|
||||
ext_data_hash = Column(VARCHAR(256), nullable=True)
|
||||
|
||||
|
||||
class AvalancheTransaction(Base): # type: ignore
|
||||
__tablename__ = "avalanche_transactions"
|
||||
|
||||
hash = Column(
|
||||
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
|
||||
)
|
||||
block_number = Column(
|
||||
BigInteger,
|
||||
ForeignKey("avalanche_blocks.block_number", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
from_address = Column(VARCHAR(256), index=True)
|
||||
to_address = Column(VARCHAR(256), index=True)
|
||||
gas = Column(Numeric(precision=78, scale=0), index=True)
|
||||
gas_price = Column(Numeric(precision=78, scale=0), index=True)
|
||||
max_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
max_priority_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
input = Column(Text)
|
||||
nonce = Column(VARCHAR(256))
|
||||
transaction_index = Column(BigInteger)
|
||||
transaction_type = Column(Integer, nullable=True)
|
||||
value = Column(Numeric(precision=78, scale=0), index=True)
|
||||
|
||||
indexed_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class AvalancheLabel(Base): # type: ignore
|
||||
__tablename__ = "avalanche_labels"
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"ix_avalanche_labels_address_block_number",
|
||||
"address",
|
||||
"block_number",
|
||||
unique=False,
|
||||
),
|
||||
Index(
|
||||
"ix_avalanche_labels_address_block_timestamp",
|
||||
"address",
|
||||
"block_timestamp",
|
||||
unique=False,
|
||||
),
|
||||
)
|
||||
|
||||
id = Column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
default=uuid.uuid4,
|
||||
unique=True,
|
||||
nullable=False,
|
||||
)
|
||||
label = Column(VARCHAR(256), nullable=False, index=True)
|
||||
block_number = Column(
|
||||
BigInteger,
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
address = Column(
|
||||
VARCHAR(256),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
transaction_hash = Column(
|
||||
VARCHAR(256),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
label_data = Column(JSONB, nullable=True)
|
||||
block_timestamp = Column(BigInteger, index=True)
|
||||
log_index = Column(Integer, nullable=True)
|
||||
created_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class AvalancheFujiBlock(Base): # type: ignore
|
||||
__tablename__ = "avalanche_fuji_blocks"
|
||||
|
||||
block_number = Column(
|
||||
BigInteger, primary_key=True, unique=True, nullable=False, index=True
|
||||
)
|
||||
difficulty = Column(BigInteger)
|
||||
extra_data = Column(VARCHAR(128))
|
||||
gas_limit = Column(BigInteger)
|
||||
gas_used = Column(BigInteger)
|
||||
base_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
hash = Column(VARCHAR(256), index=True)
|
||||
logs_bloom = Column(VARCHAR(1024))
|
||||
miner = Column(VARCHAR(256))
|
||||
nonce = Column(VARCHAR(256))
|
||||
parent_hash = Column(VARCHAR(256))
|
||||
receipt_root = Column(VARCHAR(256))
|
||||
uncles = Column(VARCHAR(256))
|
||||
size = Column(Integer)
|
||||
state_root = Column(VARCHAR(256))
|
||||
timestamp = Column(BigInteger, index=True)
|
||||
total_difficulty = Column(VARCHAR(256))
|
||||
transactions_root = Column(VARCHAR(256))
|
||||
|
||||
indexed_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
mix_hash = Column(VARCHAR(256), nullable=True)
|
||||
block_extra_data = Column(VARCHAR(256), nullable=True)
|
||||
block_gas_cost = Column(VARCHAR(256), nullable=True)
|
||||
ext_data_gas_used = Column(VARCHAR(256), nullable=True)
|
||||
ext_data_hash = Column(VARCHAR(256), nullable=True)
|
||||
|
||||
|
||||
class AvalancheFujiTransaction(Base): # type: ignore
|
||||
__tablename__ = "avalanche_fuji_transactions"
|
||||
|
||||
hash = Column(
|
||||
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
|
||||
)
|
||||
block_number = Column(
|
||||
BigInteger,
|
||||
ForeignKey("avalanche_fuji_blocks.block_number", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
from_address = Column(VARCHAR(256), index=True)
|
||||
to_address = Column(VARCHAR(256), index=True)
|
||||
gas = Column(Numeric(precision=78, scale=0), index=True)
|
||||
gas_price = Column(Numeric(precision=78, scale=0), index=True)
|
||||
max_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
max_priority_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
|
||||
input = Column(Text)
|
||||
nonce = Column(VARCHAR(256))
|
||||
transaction_index = Column(BigInteger)
|
||||
transaction_type = Column(Integer, nullable=True)
|
||||
value = Column(Numeric(precision=78, scale=0), index=True)
|
||||
|
||||
indexed_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class AvalancheFujiLabel(Base): # type: ignore
|
||||
__tablename__ = "avalanche_fuji_labels"
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"ix_avalanche_fuji_labels_address_block_number",
|
||||
"address",
|
||||
"block_number",
|
||||
unique=False,
|
||||
),
|
||||
Index(
|
||||
"ix_avalanche_fuji_labels_address_block_timestamp",
|
||||
"address",
|
||||
"block_timestamp",
|
||||
unique=False,
|
||||
),
|
||||
)
|
||||
|
||||
id = Column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
default=uuid.uuid4,
|
||||
unique=True,
|
||||
nullable=False,
|
||||
)
|
||||
label = Column(VARCHAR(256), nullable=False, index=True)
|
||||
block_number = Column(
|
||||
BigInteger,
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
address = Column(
|
||||
VARCHAR(256),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
transaction_hash = Column(
|
||||
VARCHAR(256),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
label_data = Column(JSONB, nullable=True)
|
||||
block_timestamp = Column(BigInteger, index=True)
|
||||
log_index = Column(Integer, nullable=True)
|
||||
created_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class ESDFunctionSignature(Base): # type: ignore
|
||||
"""
|
||||
Function signature from blockchain (Ethereum/Polygon) Signature Database.
|
||||
|
|
|
@ -2,6 +2,18 @@ from enum import Enum
|
|||
from typing import Dict, Union
|
||||
|
||||
from .models import (
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumSepoliaBlock,
|
||||
ArbitrumSepoliaLabel,
|
||||
ArbitrumSepoliaTransaction,
|
||||
AvalancheBlock,
|
||||
AvalancheFujiBlock,
|
||||
AvalancheFujiLabel,
|
||||
AvalancheFujiTransaction,
|
||||
AvalancheLabel,
|
||||
AvalancheTransaction,
|
||||
Base,
|
||||
EthereumBlock,
|
||||
EthereumLabel,
|
||||
|
@ -15,24 +27,21 @@ from .models import (
|
|||
WyrmBlock,
|
||||
WyrmLabel,
|
||||
WyrmTransaction,
|
||||
XDaiBlock,
|
||||
XDaiLabel,
|
||||
XDaiTransaction,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraBlock,
|
||||
ZkSyncEraLabel,
|
||||
ZkSyncEraTransaction,
|
||||
ArbitrumNovaBlock,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumNovaLabel,
|
||||
ArbitrumSepoliaBlock,
|
||||
ArbitrumSepoliaTransaction,
|
||||
ArbitrumSepoliaLabel,
|
||||
XaiBlock,
|
||||
XaiLabel,
|
||||
XaiTransaction,
|
||||
XDaiBlock,
|
||||
XDaiLabel,
|
||||
XDaiTransaction,
|
||||
ZkSyncEraBlock,
|
||||
ZkSyncEraLabel,
|
||||
ZkSyncEraSepoliaBlock,
|
||||
ZkSyncEraSepoliaLabel,
|
||||
ZkSyncEraSepoliaTransaction,
|
||||
ZkSyncEraTestnetBlock,
|
||||
ZkSyncEraTestnetLabel,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraTransaction,
|
||||
)
|
||||
|
||||
|
||||
|
@ -44,9 +53,12 @@ class Network(Enum):
|
|||
wyrm = "wyrm"
|
||||
zksync_era_testnet = "zksync_era_testnet"
|
||||
zksync_era = "zksync_era"
|
||||
zksync_era_sepolia = "zksync_era_sepolia"
|
||||
arbitrum_nova = "arbitrum_nova"
|
||||
arbitrum_sepolia = "arbitrum_sepolia"
|
||||
xai = "xai"
|
||||
avalanche = "avalanche"
|
||||
avalanche_fuji = "avalanche_fuji"
|
||||
|
||||
|
||||
tx_raw_types = Union[
|
||||
|
@ -57,9 +69,12 @@ tx_raw_types = Union[
|
|||
XDaiTransaction,
|
||||
ZkSyncEraTestnetTransaction,
|
||||
ZkSyncEraTransaction,
|
||||
ZkSyncEraSepoliaTransaction,
|
||||
ArbitrumNovaTransaction,
|
||||
ArbitrumSepoliaTransaction,
|
||||
XaiTransaction,
|
||||
AvalancheTransaction,
|
||||
AvalancheFujiTransaction,
|
||||
]
|
||||
|
||||
MODELS: Dict[Network, Dict[str, Base]] = {
|
||||
|
@ -94,6 +109,11 @@ MODELS: Dict[Network, Dict[str, Base]] = {
|
|||
"transactions": ZkSyncEraTestnetTransaction,
|
||||
},
|
||||
Network.zksync_era: {
|
||||
"blocks": ZkSyncEraSepoliaBlock,
|
||||
"labels": ZkSyncEraSepoliaLabel,
|
||||
"transactions": ZkSyncEraSepoliaTransaction,
|
||||
},
|
||||
Network.zksync_era_sepolia: {
|
||||
"blocks": ZkSyncEraBlock,
|
||||
"labels": ZkSyncEraLabel,
|
||||
"transactions": ZkSyncEraTransaction,
|
||||
|
@ -113,4 +133,14 @@ MODELS: Dict[Network, Dict[str, Base]] = {
|
|||
"labels": XaiLabel,
|
||||
"transactions": XaiTransaction,
|
||||
},
|
||||
Network.avalanche: {
|
||||
"blocks": AvalancheBlock,
|
||||
"labels": AvalancheLabel,
|
||||
"transactions": AvalancheTransaction,
|
||||
},
|
||||
Network.avalanche_fuji: {
|
||||
"blocks": AvalancheFujiBlock,
|
||||
"labels": AvalancheFujiLabel,
|
||||
"transactions": AvalancheFujiTransaction,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
Moonstream database version.
|
||||
"""
|
||||
|
||||
MOONSTREAMDB_VERSION = "0.3.8"
|
||||
MOONSTREAMDB_VERSION = "0.3.9"
|
||||
|
|
Ładowanie…
Reference in New Issue