From 415573af440110c05f5dbf6da931c6dbd7ac9f52 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 11 Nov 2024 17:13:09 +0200 Subject: [PATCH 1/2] Add ronin chain models. --- moonstreamdb-v3/moonstreamdbv3/alembic/env.py | 4 + .../versions/f8ea378cffbf_add_ronin.py | 325 ++++++++++++++++++ .../moonstreamdbv3/alembic_indexes/env.py | 12 + .../versions/eb58ea988635_add_ronin_chain.py | 295 ++++++++++++++++ moonstreamdb-v3/moonstreamdbv3/models.py | 90 +++++ .../moonstreamdbv3/models_indexes.py | 24 ++ moonstreamdb-v3/moonstreamdbv3/version.txt | 2 +- 7 files changed, 751 insertions(+), 1 deletion(-) create mode 100644 moonstreamdb-v3/moonstreamdbv3/alembic/versions/f8ea378cffbf_add_ronin.py create mode 100644 moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/eb58ea988635_add_ronin_chain.py diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic/env.py b/moonstreamdb-v3/moonstreamdbv3/alembic/env.py index 082d718e..ce91e305 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic/env.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic/env.py @@ -48,6 +48,8 @@ from moonstreamdbv3.models import ( MumbaiLabel, PolygonLabel, ProofOfPlayApexLabel, + RoninLabel, + RoninSepoliaLabel, SepoliaLabel, StarknetLabel, StarknetSepoliaLabel, @@ -91,6 +93,8 @@ def include_symbol(tablename, schema): ImxZkevmSepoliaLabel.__tablename__, B3Label.__tablename__, B3SepoliaLabel.__tablename__, + RoninLabel.__tablename__, + RoninSepoliaLabel.__tablename__, } diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/f8ea378cffbf_add_ronin.py b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/f8ea378cffbf_add_ronin.py new file mode 100644 index 00000000..4624c09b --- /dev/null +++ b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/f8ea378cffbf_add_ronin.py @@ -0,0 +1,325 @@ +"""add ronin + +Revision ID: f8ea378cffbf +Revises: d816689b786a +Create Date: 2024-11-11 16:16:09.255737 + +""" + +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 = "f8ea378cffbf" +down_revision: Union[str, None] = "d816689b786a" +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( + "ronin_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.LargeBinary(), nullable=True), + sa.Column("origin_address", sa.LargeBinary(), nullable=True), + sa.Column("address", sa.LargeBinary(), nullable=False), + 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_ronin_labels")), + sa.UniqueConstraint("id", name=op.f("uq_ronin_labels_id")), + ) + op.create_index( + "ix_ronin_labels_addr_block_num", + "ronin_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_ronin_labels_addr_block_ts", + "ronin_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_labels_address"), "ronin_labels", ["address"], unique=False + ) + op.create_index( + op.f("ix_ronin_labels_block_number"), + "ronin_labels", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_labels_caller_address"), + "ronin_labels", + ["caller_address"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_labels_label"), "ronin_labels", ["label"], unique=False + ) + op.create_index( + op.f("ix_ronin_labels_label_name"), "ronin_labels", ["label_name"], unique=False + ) + op.create_index( + op.f("ix_ronin_labels_label_type"), "ronin_labels", ["label_type"], unique=False + ) + op.create_index( + op.f("ix_ronin_labels_origin_address"), + "ronin_labels", + ["origin_address"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_labels_transaction_hash"), + "ronin_labels", + ["transaction_hash"], + unique=False, + ) + op.create_index( + "uk_ronin_labels_tx_hash_log_idx_evt", + "ronin_labels", + ["transaction_hash", "log_index"], + unique=True, + postgresql_where=sa.text("label='seer' and label_type='event'"), + ) + op.create_index( + "uk_ronin_labels_tx_hash_log_idx_evt_raw", + "ronin_labels", + ["transaction_hash", "log_index"], + unique=True, + postgresql_where=sa.text("label='seer-raw' and label_type='event'"), + ) + op.create_index( + "uk_ronin_labels_tx_hash_tx_call", + "ronin_labels", + ["transaction_hash"], + unique=True, + postgresql_where=sa.text("label='seer' and label_type='tx_call'"), + ) + op.create_index( + "uk_ronin_labels_tx_hash_tx_call_raw", + "ronin_labels", + ["transaction_hash"], + unique=True, + postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"), + ) + op.create_table( + "ronin_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.LargeBinary(), nullable=True), + sa.Column("origin_address", sa.LargeBinary(), nullable=True), + sa.Column("address", sa.LargeBinary(), nullable=False), + 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_ronin_sepolia_labels")), + sa.UniqueConstraint("id", name=op.f("uq_ronin_sepolia_labels_id")), + ) + op.create_index( + "ix_ronin_sepolia_labels_addr_block_num", + "ronin_sepolia_labels", + ["address", "block_number"], + unique=False, + ) + op.create_index( + "ix_ronin_sepolia_labels_addr_block_ts", + "ronin_sepolia_labels", + ["address", "block_timestamp"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_address"), + "ronin_sepolia_labels", + ["address"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_block_number"), + "ronin_sepolia_labels", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_caller_address"), + "ronin_sepolia_labels", + ["caller_address"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_label"), + "ronin_sepolia_labels", + ["label"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_label_name"), + "ronin_sepolia_labels", + ["label_name"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_label_type"), + "ronin_sepolia_labels", + ["label_type"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_origin_address"), + "ronin_sepolia_labels", + ["origin_address"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_labels_transaction_hash"), + "ronin_sepolia_labels", + ["transaction_hash"], + unique=False, + ) + op.create_index( + "uk_ronin_sepolia_labels_tx_hash_log_idx_evt", + "ronin_sepolia_labels", + ["transaction_hash", "log_index"], + unique=True, + postgresql_where=sa.text("label='seer' and label_type='event'"), + ) + op.create_index( + "uk_ronin_sepolia_labels_tx_hash_log_idx_evt_raw", + "ronin_sepolia_labels", + ["transaction_hash", "log_index"], + unique=True, + postgresql_where=sa.text("label='seer-raw' and label_type='event'"), + ) + op.create_index( + "uk_ronin_sepolia_labels_tx_hash_tx_call", + "ronin_sepolia_labels", + ["transaction_hash"], + unique=True, + postgresql_where=sa.text("label='seer' and label_type='tx_call'"), + ) + op.create_index( + "uk_ronin_sepolia_labels_tx_hash_tx_call_raw", + "ronin_sepolia_labels", + ["transaction_hash"], + unique=True, + postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"), + ) + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index( + "uk_ronin_sepolia_labels_tx_hash_tx_call_raw", + table_name="ronin_sepolia_labels", + postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"), + ) + op.drop_index( + "uk_ronin_sepolia_labels_tx_hash_tx_call", + table_name="ronin_sepolia_labels", + postgresql_where=sa.text("label='seer' and label_type='tx_call'"), + ) + op.drop_index( + "uk_ronin_sepolia_labels_tx_hash_log_idx_evt_raw", + table_name="ronin_sepolia_labels", + postgresql_where=sa.text("label='seer-raw' and label_type='event'"), + ) + op.drop_index( + "uk_ronin_sepolia_labels_tx_hash_log_idx_evt", + table_name="ronin_sepolia_labels", + postgresql_where=sa.text("label='seer' and label_type='event'"), + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_transaction_hash"), + table_name="ronin_sepolia_labels", + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_origin_address"), + table_name="ronin_sepolia_labels", + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_label_type"), table_name="ronin_sepolia_labels" + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_label_name"), table_name="ronin_sepolia_labels" + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_label"), table_name="ronin_sepolia_labels" + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_caller_address"), + table_name="ronin_sepolia_labels", + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_block_number"), table_name="ronin_sepolia_labels" + ) + op.drop_index( + op.f("ix_ronin_sepolia_labels_address"), table_name="ronin_sepolia_labels" + ) + op.drop_index( + "ix_ronin_sepolia_labels_addr_block_ts", table_name="ronin_sepolia_labels" + ) + op.drop_index( + "ix_ronin_sepolia_labels_addr_block_num", table_name="ronin_sepolia_labels" + ) + op.drop_table("ronin_sepolia_labels") + op.drop_index( + "uk_ronin_labels_tx_hash_tx_call_raw", + table_name="ronin_labels", + postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"), + ) + op.drop_index( + "uk_ronin_labels_tx_hash_tx_call", + table_name="ronin_labels", + postgresql_where=sa.text("label='seer' and label_type='tx_call'"), + ) + op.drop_index( + "uk_ronin_labels_tx_hash_log_idx_evt_raw", + table_name="ronin_labels", + postgresql_where=sa.text("label='seer-raw' and label_type='event'"), + ) + op.drop_index( + "uk_ronin_labels_tx_hash_log_idx_evt", + table_name="ronin_labels", + postgresql_where=sa.text("label='seer' and label_type='event'"), + ) + op.drop_index(op.f("ix_ronin_labels_transaction_hash"), table_name="ronin_labels") + op.drop_index(op.f("ix_ronin_labels_origin_address"), table_name="ronin_labels") + op.drop_index(op.f("ix_ronin_labels_label_type"), table_name="ronin_labels") + op.drop_index(op.f("ix_ronin_labels_label_name"), table_name="ronin_labels") + op.drop_index(op.f("ix_ronin_labels_label"), table_name="ronin_labels") + op.drop_index(op.f("ix_ronin_labels_caller_address"), table_name="ronin_labels") + op.drop_index(op.f("ix_ronin_labels_block_number"), table_name="ronin_labels") + op.drop_index(op.f("ix_ronin_labels_address"), table_name="ronin_labels") + op.drop_index("ix_ronin_labels_addr_block_ts", table_name="ronin_labels") + op.drop_index("ix_ronin_labels_addr_block_num", table_name="ronin_labels") + op.drop_table("ronin_labels") + # ### end Alembic commands ### diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py index 2e249461..c0344fe6 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py @@ -74,6 +74,12 @@ from moonstreamdbv3.models_indexes import ( PolygonLogIndex, PolygonReorgs, PolygonTransactionIndex, + RoninBlockIndex, + RoninReorgs, + RoninContracts, + RoninSepoliaBlockIndex, + RoninSepoliaReorgs, + RoninSepoliaContracts, XaiBlockIndex, XaiLogIndex, XaiReorgs, @@ -143,6 +149,12 @@ def include_symbol(tablename, schema): B3Reorgs.__tablename__, B3SepoliaBlockIndex.__tablename__, B3SepoliaReorgs.__tablename__, + RoninBlockIndex.__tablename__, + RoninReorgs.__tablename__, + RoninContracts.__tablename__, + RoninSepoliaBlockIndex.__tablename__, + RoninSepoliaReorgs.__tablename__, + RoninSepoliaContracts.__tablename__, } diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/eb58ea988635_add_ronin_chain.py b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/eb58ea988635_add_ronin_chain.py new file mode 100644 index 00000000..8ed44d2b --- /dev/null +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/eb58ea988635_add_ronin_chain.py @@ -0,0 +1,295 @@ +"""Add ronin chain + +Revision ID: eb58ea988635 +Revises: 5ce23893771f +Create Date: 2024-11-11 17:11:09.701996 + +""" + +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 = "eb58ea988635" +down_revision: Union[str, None] = "5ce23893771f" +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( + "ronin_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("transactions_indexed_at", sa.DateTime(timezone=True), nullable=True), + sa.Column("logs_indexed_at", sa.DateTime(timezone=True), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.PrimaryKeyConstraint("block_number", name=op.f("pk_ronin_blocks")), + ) + op.create_index( + op.f("ix_ronin_blocks_block_number"), + "ronin_blocks", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_blocks_block_timestamp"), + "ronin_blocks", + ["block_timestamp"], + unique=False, + ) + op.create_table( + "ronin_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_ronin_reorgs")), + ) + op.create_index( + op.f("ix_ronin_reorgs_block_hash"), "ronin_reorgs", ["block_hash"], unique=False + ) + op.create_index( + op.f("ix_ronin_reorgs_block_number"), + "ronin_reorgs", + ["block_number"], + unique=False, + ) + op.create_table( + "ronin_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("transactions_indexed_at", sa.DateTime(timezone=True), nullable=True), + sa.Column("logs_indexed_at", sa.DateTime(timezone=True), nullable=True), + sa.Column( + "indexed_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.PrimaryKeyConstraint("block_number", name=op.f("pk_ronin_sepolia_blocks")), + ) + op.create_index( + op.f("ix_ronin_sepolia_blocks_block_number"), + "ronin_sepolia_blocks", + ["block_number"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_blocks_block_timestamp"), + "ronin_sepolia_blocks", + ["block_timestamp"], + unique=False, + ) + op.create_table( + "ronin_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_ronin_sepolia_reorgs")), + ) + op.create_index( + op.f("ix_ronin_sepolia_reorgs_block_hash"), + "ronin_sepolia_reorgs", + ["block_hash"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_reorgs_block_number"), + "ronin_sepolia_reorgs", + ["block_number"], + unique=False, + ) + op.create_table( + "ronin_contracts", + sa.Column("address", sa.LargeBinary(length=20), nullable=False), + sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False), + sa.Column("deployed_bytecode", sa.Text(), nullable=False), + sa.Column("deployed_bytecode_hash", sa.VARCHAR(length=32), nullable=False), + sa.Column("bytecode_storage_id", sa.UUID(), nullable=True), + sa.Column("abi", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column("deployed_at_block_number", sa.BigInteger(), nullable=False), + sa.Column("deployed_at_block_hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("deployed_at_block_timestamp", sa.BigInteger(), nullable=False), + sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("transaction_index", sa.BigInteger(), nullable=False), + sa.Column("name", sa.VARCHAR(length=256), nullable=True), + sa.Column("statistics", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column( + "supported_standards", + 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.Column( + "updated_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.ForeignKeyConstraint( + ["bytecode_storage_id"], + ["bytecode_storage.id"], + name=op.f("fk_ronin_contracts_bytecode_storage_id_bytecode_storage"), + ), + sa.PrimaryKeyConstraint("address", name=op.f("pk_ronin_contracts")), + ) + op.create_index( + op.f("ix_ronin_contracts_deployed_by"), + "ronin_contracts", + ["deployed_by"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_contracts_deployed_bytecode_hash"), + "ronin_contracts", + ["deployed_bytecode_hash"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_contracts_name"), "ronin_contracts", ["name"], unique=False + ) + op.create_index( + op.f("ix_ronin_contracts_transaction_hash"), + "ronin_contracts", + ["transaction_hash"], + unique=False, + ) + op.create_table( + "ronin_sepolia_contracts", + sa.Column("address", sa.LargeBinary(length=20), nullable=False), + sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False), + sa.Column("deployed_bytecode", sa.Text(), nullable=False), + sa.Column("deployed_bytecode_hash", sa.VARCHAR(length=32), nullable=False), + sa.Column("bytecode_storage_id", sa.UUID(), nullable=True), + sa.Column("abi", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column("deployed_at_block_number", sa.BigInteger(), nullable=False), + sa.Column("deployed_at_block_hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("deployed_at_block_timestamp", sa.BigInteger(), nullable=False), + sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=False), + sa.Column("transaction_index", sa.BigInteger(), nullable=False), + sa.Column("name", sa.VARCHAR(length=256), nullable=True), + sa.Column("statistics", postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column( + "supported_standards", + 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.Column( + "updated_at", + sa.DateTime(timezone=True), + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), + nullable=False, + ), + sa.ForeignKeyConstraint( + ["bytecode_storage_id"], + ["bytecode_storage.id"], + name=op.f( + "fk_ronin_sepolia_contracts_bytecode_storage_id_bytecode_storage" + ), + ), + sa.PrimaryKeyConstraint("address", name=op.f("pk_ronin_sepolia_contracts")), + ) + op.create_index( + op.f("ix_ronin_sepolia_contracts_deployed_by"), + "ronin_sepolia_contracts", + ["deployed_by"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_contracts_deployed_bytecode_hash"), + "ronin_sepolia_contracts", + ["deployed_bytecode_hash"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_contracts_name"), + "ronin_sepolia_contracts", + ["name"], + unique=False, + ) + op.create_index( + op.f("ix_ronin_sepolia_contracts_transaction_hash"), + "ronin_sepolia_contracts", + ["transaction_hash"], + unique=False, + ) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index( + op.f("ix_ronin_sepolia_contracts_transaction_hash"), + table_name="ronin_sepolia_contracts", + ) + op.drop_index( + op.f("ix_ronin_sepolia_contracts_name"), table_name="ronin_sepolia_contracts" + ) + op.drop_index( + op.f("ix_ronin_sepolia_contracts_deployed_bytecode_hash"), + table_name="ronin_sepolia_contracts", + ) + op.drop_index( + op.f("ix_ronin_sepolia_contracts_deployed_by"), + table_name="ronin_sepolia_contracts", + ) + op.drop_table("ronin_sepolia_contracts") + op.drop_index( + op.f("ix_ronin_contracts_transaction_hash"), table_name="ronin_contracts" + ) + op.drop_index(op.f("ix_ronin_contracts_name"), table_name="ronin_contracts") + op.drop_index( + op.f("ix_ronin_contracts_deployed_bytecode_hash"), table_name="ronin_contracts" + ) + op.drop_index(op.f("ix_ronin_contracts_deployed_by"), table_name="ronin_contracts") + op.drop_table("ronin_contracts") + op.drop_index( + op.f("ix_ronin_sepolia_reorgs_block_number"), table_name="ronin_sepolia_reorgs" + ) + op.drop_index( + op.f("ix_ronin_sepolia_reorgs_block_hash"), table_name="ronin_sepolia_reorgs" + ) + op.drop_table("ronin_sepolia_reorgs") + op.drop_index( + op.f("ix_ronin_sepolia_blocks_block_timestamp"), + table_name="ronin_sepolia_blocks", + ) + op.drop_index( + op.f("ix_ronin_sepolia_blocks_block_number"), table_name="ronin_sepolia_blocks" + ) + op.drop_table("ronin_sepolia_blocks") + op.drop_index(op.f("ix_ronin_reorgs_block_number"), table_name="ronin_reorgs") + op.drop_index(op.f("ix_ronin_reorgs_block_hash"), table_name="ronin_reorgs") + op.drop_table("ronin_reorgs") + op.drop_index(op.f("ix_ronin_blocks_block_timestamp"), table_name="ronin_blocks") + op.drop_index(op.f("ix_ronin_blocks_block_number"), table_name="ronin_blocks") + op.drop_table("ronin_blocks") + # ### end Alembic commands ### diff --git a/moonstreamdb-v3/moonstreamdbv3/models.py b/moonstreamdb-v3/moonstreamdbv3/models.py index 1547680b..9b9b275a 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models.py +++ b/moonstreamdb-v3/moonstreamdbv3/models.py @@ -1472,3 +1472,93 @@ class B3SepoliaLabel(EvmBasedLabel): # type: ignore postgresql_where=text("label='seer-raw' and label_type='event'"), ), ) + + +class RoninLabel(EvmBasedLabel): # type: ignore + __tablename__ = "ronin_labels" + + __table_args__ = ( + Index( + "ix_ronin_labels_addr_block_num", + "address", + "block_number", + unique=False, + ), + Index( + "ix_ronin_labels_addr_block_ts", + "address", + "block_timestamp", + unique=False, + ), + Index( + "uk_ronin_labels_tx_hash_tx_call", + "transaction_hash", + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'"), + ), + Index( + "uk_ronin_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", + unique=True, + postgresql_where=text("label='seer' and label_type='event'"), + ), + Index( + "uk_ronin_labels_tx_hash_tx_call_raw", + "transaction_hash", + unique=True, + postgresql_where=text("label='seer-raw' and label_type='tx_call'"), + ), + Index( + "uk_ronin_labels_tx_hash_log_idx_evt_raw", + "transaction_hash", + "log_index", + unique=True, + postgresql_where=text("label='seer-raw' and label_type='event'"), + ), + ) + + +class RoninSepoliaLabel(EvmBasedLabel): # type: ignore + __tablename__ = "ronin_sepolia_labels" + + __table_args__ = ( + Index( + "ix_ronin_sepolia_labels_addr_block_num", + "address", + "block_number", + unique=False, + ), + Index( + "ix_ronin_sepolia_labels_addr_block_ts", + "address", + "block_timestamp", + unique=False, + ), + Index( + "uk_ronin_sepolia_labels_tx_hash_tx_call", + "transaction_hash", + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'"), + ), + Index( + "uk_ronin_sepolia_labels_tx_hash_log_idx_evt", + "transaction_hash", + "log_index", + unique=True, + postgresql_where=text("label='seer' and label_type='event'"), + ), + Index( + "uk_ronin_sepolia_labels_tx_hash_tx_call_raw", + "transaction_hash", + unique=True, + postgresql_where=text("label='seer-raw' and label_type='tx_call'"), + ), + Index( + "uk_ronin_sepolia_labels_tx_hash_log_idx_evt_raw", + "transaction_hash", + "log_index", + unique=True, + postgresql_where=text("label='seer-raw' and label_type='event'"), + ), + ) diff --git a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py index ff1bf5a6..cd5cacfb 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py @@ -904,6 +904,30 @@ class B3SepoliaContracts(evmBasedContracts): __tablename__ = "b3_sepolia_contracts" +class RoninBlockIndex(EvmBasedBlocks): + __tablename__ = "ronin_blocks" + + +class RoninReorgs(EvmBasedReorgs): + __tablename__ = "ronin_reorgs" + + +class RoninContracts(evmBasedContracts): + __tablename__ = "ronin_contracts" + + +class RoninSepoliaBlockIndex(EvmBasedBlocks): + __tablename__ = "ronin_sepolia_blocks" + + +class RoninSepoliaReorgs(EvmBasedReorgs): + __tablename__ = "ronin_sepolia_reorgs" + + +class RoninSepoliaContracts(evmBasedContracts): + __tablename__ = "ronin_sepolia_contracts" + + ### ABI Jobs diff --git a/moonstreamdb-v3/moonstreamdbv3/version.txt b/moonstreamdb-v3/moonstreamdbv3/version.txt index 17e51c38..d917d3e2 100644 --- a/moonstreamdb-v3/moonstreamdbv3/version.txt +++ b/moonstreamdb-v3/moonstreamdbv3/version.txt @@ -1 +1 @@ -0.1.1 +0.1.2 From 32423085fe1faeb8ed4352bd90161b97061d6d2b Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 12 Nov 2024 12:59:24 +0200 Subject: [PATCH 2/2] rename sepolia -> saigon. --- moonstreamdb-v3/moonstreamdbv3/alembic/env.py | 4 +- ...nin.py => e6d3c285e7cc_add_ronin_chain.py} | 113 +++++++++--------- .../moonstreamdbv3/alembic_indexes/env.py | 12 +- ...ain.py => 8610f3c98043_add_ronin_chain.py} | 85 +++++++------ moonstreamdb-v3/moonstreamdbv3/models.py | 16 +-- .../moonstreamdbv3/models_indexes.py | 12 +- 6 files changed, 119 insertions(+), 123 deletions(-) rename moonstreamdb-v3/moonstreamdbv3/alembic/versions/{f8ea378cffbf_add_ronin.py => e6d3c285e7cc_add_ronin_chain.py} (75%) rename moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/{eb58ea988635_add_ronin_chain.py => 8610f3c98043_add_ronin_chain.py} (81%) diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic/env.py b/moonstreamdb-v3/moonstreamdbv3/alembic/env.py index ce91e305..62dcb91b 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic/env.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic/env.py @@ -49,7 +49,7 @@ from moonstreamdbv3.models import ( PolygonLabel, ProofOfPlayApexLabel, RoninLabel, - RoninSepoliaLabel, + RoninSaigonLabel, SepoliaLabel, StarknetLabel, StarknetSepoliaLabel, @@ -94,7 +94,7 @@ def include_symbol(tablename, schema): B3Label.__tablename__, B3SepoliaLabel.__tablename__, RoninLabel.__tablename__, - RoninSepoliaLabel.__tablename__, + RoninSaigonLabel.__tablename__, } diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/f8ea378cffbf_add_ronin.py b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/e6d3c285e7cc_add_ronin_chain.py similarity index 75% rename from moonstreamdb-v3/moonstreamdbv3/alembic/versions/f8ea378cffbf_add_ronin.py rename to moonstreamdb-v3/moonstreamdbv3/alembic/versions/e6d3c285e7cc_add_ronin_chain.py index 4624c09b..98e53a65 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/f8ea378cffbf_add_ronin.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/e6d3c285e7cc_add_ronin_chain.py @@ -1,8 +1,8 @@ -"""add ronin +"""add ronin chain -Revision ID: f8ea378cffbf +Revision ID: e6d3c285e7cc Revises: d816689b786a -Create Date: 2024-11-11 16:16:09.255737 +Create Date: 2024-11-12 12:54:33.415972 """ @@ -13,7 +13,7 @@ import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. -revision: str = "f8ea378cffbf" +revision: str = "e6d3c285e7cc" down_revision: Union[str, None] = "d816689b786a" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None @@ -122,7 +122,7 @@ def upgrade() -> None: postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"), ) op.create_table( - "ronin_sepolia_labels", + "ronin_saigon_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), @@ -142,155 +142,154 @@ def upgrade() -> None: server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False, ), - sa.PrimaryKeyConstraint("id", name=op.f("pk_ronin_sepolia_labels")), - sa.UniqueConstraint("id", name=op.f("uq_ronin_sepolia_labels_id")), + sa.PrimaryKeyConstraint("id", name=op.f("pk_ronin_saigon_labels")), + sa.UniqueConstraint("id", name=op.f("uq_ronin_saigon_labels_id")), ) op.create_index( - "ix_ronin_sepolia_labels_addr_block_num", - "ronin_sepolia_labels", + "ix_ronin_saigon_labels_addr_block_num", + "ronin_saigon_labels", ["address", "block_number"], unique=False, ) op.create_index( - "ix_ronin_sepolia_labels_addr_block_ts", - "ronin_sepolia_labels", + "ix_ronin_saigon_labels_addr_block_ts", + "ronin_saigon_labels", ["address", "block_timestamp"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_address"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_address"), + "ronin_saigon_labels", ["address"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_block_number"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_block_number"), + "ronin_saigon_labels", ["block_number"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_caller_address"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_caller_address"), + "ronin_saigon_labels", ["caller_address"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_label"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_label"), + "ronin_saigon_labels", ["label"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_label_name"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_label_name"), + "ronin_saigon_labels", ["label_name"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_label_type"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_label_type"), + "ronin_saigon_labels", ["label_type"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_origin_address"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_origin_address"), + "ronin_saigon_labels", ["origin_address"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_labels_transaction_hash"), - "ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_transaction_hash"), + "ronin_saigon_labels", ["transaction_hash"], unique=False, ) op.create_index( - "uk_ronin_sepolia_labels_tx_hash_log_idx_evt", - "ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_log_idx_evt", + "ronin_saigon_labels", ["transaction_hash", "log_index"], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'"), ) op.create_index( - "uk_ronin_sepolia_labels_tx_hash_log_idx_evt_raw", - "ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_log_idx_evt_raw", + "ronin_saigon_labels", ["transaction_hash", "log_index"], unique=True, postgresql_where=sa.text("label='seer-raw' and label_type='event'"), ) op.create_index( - "uk_ronin_sepolia_labels_tx_hash_tx_call", - "ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_tx_call", + "ronin_saigon_labels", ["transaction_hash"], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'"), ) op.create_index( - "uk_ronin_sepolia_labels_tx_hash_tx_call_raw", - "ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_tx_call_raw", + "ronin_saigon_labels", ["transaction_hash"], unique=True, postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"), ) + # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index( - "uk_ronin_sepolia_labels_tx_hash_tx_call_raw", - table_name="ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_tx_call_raw", + table_name="ronin_saigon_labels", postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"), ) op.drop_index( - "uk_ronin_sepolia_labels_tx_hash_tx_call", - table_name="ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_tx_call", + table_name="ronin_saigon_labels", postgresql_where=sa.text("label='seer' and label_type='tx_call'"), ) op.drop_index( - "uk_ronin_sepolia_labels_tx_hash_log_idx_evt_raw", - table_name="ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_log_idx_evt_raw", + table_name="ronin_saigon_labels", postgresql_where=sa.text("label='seer-raw' and label_type='event'"), ) op.drop_index( - "uk_ronin_sepolia_labels_tx_hash_log_idx_evt", - table_name="ronin_sepolia_labels", + "uk_ronin_saigon_labels_tx_hash_log_idx_evt", + table_name="ronin_saigon_labels", postgresql_where=sa.text("label='seer' and label_type='event'"), ) op.drop_index( - op.f("ix_ronin_sepolia_labels_transaction_hash"), - table_name="ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_transaction_hash"), + table_name="ronin_saigon_labels", ) op.drop_index( - op.f("ix_ronin_sepolia_labels_origin_address"), - table_name="ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_origin_address"), table_name="ronin_saigon_labels" ) op.drop_index( - op.f("ix_ronin_sepolia_labels_label_type"), table_name="ronin_sepolia_labels" + op.f("ix_ronin_saigon_labels_label_type"), table_name="ronin_saigon_labels" ) op.drop_index( - op.f("ix_ronin_sepolia_labels_label_name"), table_name="ronin_sepolia_labels" + op.f("ix_ronin_saigon_labels_label_name"), table_name="ronin_saigon_labels" ) op.drop_index( - op.f("ix_ronin_sepolia_labels_label"), table_name="ronin_sepolia_labels" + op.f("ix_ronin_saigon_labels_label"), table_name="ronin_saigon_labels" ) op.drop_index( - op.f("ix_ronin_sepolia_labels_caller_address"), - table_name="ronin_sepolia_labels", + op.f("ix_ronin_saigon_labels_caller_address"), table_name="ronin_saigon_labels" ) op.drop_index( - op.f("ix_ronin_sepolia_labels_block_number"), table_name="ronin_sepolia_labels" + op.f("ix_ronin_saigon_labels_block_number"), table_name="ronin_saigon_labels" ) op.drop_index( - op.f("ix_ronin_sepolia_labels_address"), table_name="ronin_sepolia_labels" + op.f("ix_ronin_saigon_labels_address"), table_name="ronin_saigon_labels" ) op.drop_index( - "ix_ronin_sepolia_labels_addr_block_ts", table_name="ronin_sepolia_labels" + "ix_ronin_saigon_labels_addr_block_ts", table_name="ronin_saigon_labels" ) op.drop_index( - "ix_ronin_sepolia_labels_addr_block_num", table_name="ronin_sepolia_labels" + "ix_ronin_saigon_labels_addr_block_num", table_name="ronin_saigon_labels" ) - op.drop_table("ronin_sepolia_labels") + op.drop_table("ronin_saigon_labels") op.drop_index( "uk_ronin_labels_tx_hash_tx_call_raw", table_name="ronin_labels", diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py index c0344fe6..86be8d4b 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py @@ -77,9 +77,9 @@ from moonstreamdbv3.models_indexes import ( RoninBlockIndex, RoninReorgs, RoninContracts, - RoninSepoliaBlockIndex, - RoninSepoliaReorgs, - RoninSepoliaContracts, + RoninSaigonBlockIndex, + RoninSaigonReorgs, + RoninSaigonContracts, XaiBlockIndex, XaiLogIndex, XaiReorgs, @@ -152,9 +152,9 @@ def include_symbol(tablename, schema): RoninBlockIndex.__tablename__, RoninReorgs.__tablename__, RoninContracts.__tablename__, - RoninSepoliaBlockIndex.__tablename__, - RoninSepoliaReorgs.__tablename__, - RoninSepoliaContracts.__tablename__, + RoninSaigonBlockIndex.__tablename__, + RoninSaigonReorgs.__tablename__, + RoninSaigonContracts.__tablename__, } diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/eb58ea988635_add_ronin_chain.py b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8610f3c98043_add_ronin_chain.py similarity index 81% rename from moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/eb58ea988635_add_ronin_chain.py rename to moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8610f3c98043_add_ronin_chain.py index 8ed44d2b..e5b68bc3 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/eb58ea988635_add_ronin_chain.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/8610f3c98043_add_ronin_chain.py @@ -1,8 +1,8 @@ -"""Add ronin chain +"""add ronin chain -Revision ID: eb58ea988635 +Revision ID: 8610f3c98043 Revises: 5ce23893771f -Create Date: 2024-11-11 17:11:09.701996 +Create Date: 2024-11-12 12:54:26.532910 """ @@ -13,7 +13,7 @@ import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. -revision: str = "eb58ea988635" +revision: str = "8610f3c98043" down_revision: Union[str, None] = "5ce23893771f" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None @@ -68,7 +68,7 @@ def upgrade() -> None: unique=False, ) op.create_table( - "ronin_sepolia_blocks", + "ronin_saigon_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), @@ -83,36 +83,36 @@ def upgrade() -> None: server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False, ), - sa.PrimaryKeyConstraint("block_number", name=op.f("pk_ronin_sepolia_blocks")), + sa.PrimaryKeyConstraint("block_number", name=op.f("pk_ronin_saigon_blocks")), ) op.create_index( - op.f("ix_ronin_sepolia_blocks_block_number"), - "ronin_sepolia_blocks", + op.f("ix_ronin_saigon_blocks_block_number"), + "ronin_saigon_blocks", ["block_number"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_blocks_block_timestamp"), - "ronin_sepolia_blocks", + op.f("ix_ronin_saigon_blocks_block_timestamp"), + "ronin_saigon_blocks", ["block_timestamp"], unique=False, ) op.create_table( - "ronin_sepolia_reorgs", + "ronin_saigon_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_ronin_sepolia_reorgs")), + sa.PrimaryKeyConstraint("id", name=op.f("pk_ronin_saigon_reorgs")), ) op.create_index( - op.f("ix_ronin_sepolia_reorgs_block_hash"), - "ronin_sepolia_reorgs", + op.f("ix_ronin_saigon_reorgs_block_hash"), + "ronin_saigon_reorgs", ["block_hash"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_reorgs_block_number"), - "ronin_sepolia_reorgs", + op.f("ix_ronin_saigon_reorgs_block_number"), + "ronin_saigon_reorgs", ["block_number"], unique=False, ) @@ -177,7 +177,7 @@ def upgrade() -> None: unique=False, ) op.create_table( - "ronin_sepolia_contracts", + "ronin_saigon_contracts", sa.Column("address", sa.LargeBinary(length=20), nullable=False), sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False), sa.Column("deployed_bytecode", sa.Text(), nullable=False), @@ -211,33 +211,31 @@ def upgrade() -> None: sa.ForeignKeyConstraint( ["bytecode_storage_id"], ["bytecode_storage.id"], - name=op.f( - "fk_ronin_sepolia_contracts_bytecode_storage_id_bytecode_storage" - ), + name=op.f("fk_ronin_saigon_contracts_bytecode_storage_id_bytecode_storage"), ), - sa.PrimaryKeyConstraint("address", name=op.f("pk_ronin_sepolia_contracts")), + sa.PrimaryKeyConstraint("address", name=op.f("pk_ronin_saigon_contracts")), ) op.create_index( - op.f("ix_ronin_sepolia_contracts_deployed_by"), - "ronin_sepolia_contracts", + op.f("ix_ronin_saigon_contracts_deployed_by"), + "ronin_saigon_contracts", ["deployed_by"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_contracts_deployed_bytecode_hash"), - "ronin_sepolia_contracts", + op.f("ix_ronin_saigon_contracts_deployed_bytecode_hash"), + "ronin_saigon_contracts", ["deployed_bytecode_hash"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_contracts_name"), - "ronin_sepolia_contracts", + op.f("ix_ronin_saigon_contracts_name"), + "ronin_saigon_contracts", ["name"], unique=False, ) op.create_index( - op.f("ix_ronin_sepolia_contracts_transaction_hash"), - "ronin_sepolia_contracts", + op.f("ix_ronin_saigon_contracts_transaction_hash"), + "ronin_saigon_contracts", ["transaction_hash"], unique=False, ) @@ -247,21 +245,21 @@ def upgrade() -> None: def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index( - op.f("ix_ronin_sepolia_contracts_transaction_hash"), - table_name="ronin_sepolia_contracts", + op.f("ix_ronin_saigon_contracts_transaction_hash"), + table_name="ronin_saigon_contracts", ) op.drop_index( - op.f("ix_ronin_sepolia_contracts_name"), table_name="ronin_sepolia_contracts" + op.f("ix_ronin_saigon_contracts_name"), table_name="ronin_saigon_contracts" ) op.drop_index( - op.f("ix_ronin_sepolia_contracts_deployed_bytecode_hash"), - table_name="ronin_sepolia_contracts", + op.f("ix_ronin_saigon_contracts_deployed_bytecode_hash"), + table_name="ronin_saigon_contracts", ) op.drop_index( - op.f("ix_ronin_sepolia_contracts_deployed_by"), - table_name="ronin_sepolia_contracts", + op.f("ix_ronin_saigon_contracts_deployed_by"), + table_name="ronin_saigon_contracts", ) - op.drop_table("ronin_sepolia_contracts") + op.drop_table("ronin_saigon_contracts") op.drop_index( op.f("ix_ronin_contracts_transaction_hash"), table_name="ronin_contracts" ) @@ -272,20 +270,19 @@ def downgrade() -> None: op.drop_index(op.f("ix_ronin_contracts_deployed_by"), table_name="ronin_contracts") op.drop_table("ronin_contracts") op.drop_index( - op.f("ix_ronin_sepolia_reorgs_block_number"), table_name="ronin_sepolia_reorgs" + op.f("ix_ronin_saigon_reorgs_block_number"), table_name="ronin_saigon_reorgs" ) op.drop_index( - op.f("ix_ronin_sepolia_reorgs_block_hash"), table_name="ronin_sepolia_reorgs" + op.f("ix_ronin_saigon_reorgs_block_hash"), table_name="ronin_saigon_reorgs" ) - op.drop_table("ronin_sepolia_reorgs") + op.drop_table("ronin_saigon_reorgs") op.drop_index( - op.f("ix_ronin_sepolia_blocks_block_timestamp"), - table_name="ronin_sepolia_blocks", + op.f("ix_ronin_saigon_blocks_block_timestamp"), table_name="ronin_saigon_blocks" ) op.drop_index( - op.f("ix_ronin_sepolia_blocks_block_number"), table_name="ronin_sepolia_blocks" + op.f("ix_ronin_saigon_blocks_block_number"), table_name="ronin_saigon_blocks" ) - op.drop_table("ronin_sepolia_blocks") + op.drop_table("ronin_saigon_blocks") op.drop_index(op.f("ix_ronin_reorgs_block_number"), table_name="ronin_reorgs") op.drop_index(op.f("ix_ronin_reorgs_block_hash"), table_name="ronin_reorgs") op.drop_table("ronin_reorgs") diff --git a/moonstreamdb-v3/moonstreamdbv3/models.py b/moonstreamdb-v3/moonstreamdbv3/models.py index 9b9b275a..498783fb 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models.py +++ b/moonstreamdb-v3/moonstreamdbv3/models.py @@ -1519,43 +1519,43 @@ class RoninLabel(EvmBasedLabel): # type: ignore ) -class RoninSepoliaLabel(EvmBasedLabel): # type: ignore - __tablename__ = "ronin_sepolia_labels" +class RoninSaigonLabel(EvmBasedLabel): # type: ignore + __tablename__ = "ronin_saigon_labels" __table_args__ = ( Index( - "ix_ronin_sepolia_labels_addr_block_num", + "ix_ronin_saigon_labels_addr_block_num", "address", "block_number", unique=False, ), Index( - "ix_ronin_sepolia_labels_addr_block_ts", + "ix_ronin_saigon_labels_addr_block_ts", "address", "block_timestamp", unique=False, ), Index( - "uk_ronin_sepolia_labels_tx_hash_tx_call", + "uk_ronin_saigon_labels_tx_hash_tx_call", "transaction_hash", unique=True, postgresql_where=text("label='seer' and label_type='tx_call'"), ), Index( - "uk_ronin_sepolia_labels_tx_hash_log_idx_evt", + "uk_ronin_saigon_labels_tx_hash_log_idx_evt", "transaction_hash", "log_index", unique=True, postgresql_where=text("label='seer' and label_type='event'"), ), Index( - "uk_ronin_sepolia_labels_tx_hash_tx_call_raw", + "uk_ronin_saigon_labels_tx_hash_tx_call_raw", "transaction_hash", unique=True, postgresql_where=text("label='seer-raw' and label_type='tx_call'"), ), Index( - "uk_ronin_sepolia_labels_tx_hash_log_idx_evt_raw", + "uk_ronin_saigon_labels_tx_hash_log_idx_evt_raw", "transaction_hash", "log_index", unique=True, diff --git a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py index cd5cacfb..f1e28a05 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/models_indexes.py @@ -916,16 +916,16 @@ class RoninContracts(evmBasedContracts): __tablename__ = "ronin_contracts" -class RoninSepoliaBlockIndex(EvmBasedBlocks): - __tablename__ = "ronin_sepolia_blocks" +class RoninSaigonBlockIndex(EvmBasedBlocks): + __tablename__ = "ronin_saigon_blocks" -class RoninSepoliaReorgs(EvmBasedReorgs): - __tablename__ = "ronin_sepolia_reorgs" +class RoninSaigonReorgs(EvmBasedReorgs): + __tablename__ = "ronin_saigon_reorgs" -class RoninSepoliaContracts(evmBasedContracts): - __tablename__ = "ronin_sepolia_contracts" +class RoninSaigonContracts(evmBasedContracts): + __tablename__ = "ronin_saigon_contracts" ### ABI Jobs