Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add game 7 testnet. #1121

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions moonstreamapi/configs/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export MOONSTREAM_MANTLE_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node
export MOONSTREAM_MANTLE_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"

export MOONSTREAM_QUERIES_JOURNAL_ID="<bugout_journal_id_where_store_queries_for_executing>"
export MOONSTREAM_USAGE_REPORTS_JOURNAL_ID="<bugout_journal_id_where_save_generated_reports>"
Expand Down
11 changes: 11 additions & 0 deletions moonstreamapi/moonstreamapi/admin/subscription_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,17 @@
stripe_price_id=None,
active=True,
),
"game7_testnet_smartcontract": SubscriptionTypeResourceData(
id="game7_testnet_smartcontract",
name="Game7 Testnet smartcontracts",
blockchain="game7_testnet",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Game7 testnet blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/game7-testnet-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"ethereum_blockchain": SubscriptionTypeResourceData(
id="ethereum_blockchain",
name="Ethereum transactions",
Expand Down
9 changes: 9 additions & 0 deletions moonstreamapi/moonstreamapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@
"MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI environment variable must be set"
)

MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI == "":
raise Exception(
"MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI env variable is not set"
)


## QueryAPI

MOONSTREAM_S3_QUERIES_BUCKET = os.environ.get("MOONSTREAM_S3_QUERIES_BUCKET", "")
Expand Down
2 changes: 1 addition & 1 deletion moonstreamapi/moonstreamapi/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Moonstream library and API version.
"""

MOONSTREAMAPI_VERSION = "0.4.6"
MOONSTREAMAPI_VERSION = "0.4.7"
3 changes: 3 additions & 0 deletions moonstreamapi/moonstreamapi/web3_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI,
MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI,
NB_ACCESS_ID_HEADER,
multicall_contract_abi,
multicall_contracts,
Expand Down Expand Up @@ -124,6 +125,8 @@ def connect(
web3_uri = MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
web3_uri = MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
web3_uri = MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI
else:
raise Exception("Wrong blockchain type provided for web3 URI")

Expand Down
2 changes: 1 addition & 1 deletion moonstreamapi/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Mako==1.2.3
MarkupSafe==2.1.1
moonstream==0.1.1
moonstreamdb==0.4.5
moonstreamdb-v3==0.0.15
moonstreamdb-v3==0.0.16
multiaddr==0.0.9
multidict==6.0.2
netaddr==0.8.0
Expand Down
2 changes: 1 addition & 1 deletion moonstreamapi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"fastapi",
"moonstream",
"moonstreamdb>=0.4.5",
"moonstreamdb-v3>=0.0.15",
"moonstreamdb-v3>=0.0.16",
"humbug",
"pydantic==1.10.2",
"pyevmasm",
Expand Down
2 changes: 2 additions & 0 deletions moonstreamdb-v3/moonstreamdbv3/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
BlastSepoliaLabel,
EthereumLabel,
Game7OrbitArbitrumSepoliaLabel,
Game7TestnetLabel,
ImxZkevmLabel,
ImxZkevmSepoliaLabel,
MantleLabel,
Expand Down Expand Up @@ -69,6 +70,7 @@ def include_symbol(tablename, schema):
ArbitrumOneLabel.__tablename__,
ArbitrumSepoliaLabel.__tablename__,
Game7OrbitArbitrumSepoliaLabel.__tablename__,
Game7TestnetLabel.__tablename__,
XaiLabel.__tablename__,
XaiSepoliaLabel.__tablename__,
AvalancheLabel.__tablename__,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
"""Add game7 testnet

Revision ID: db9559f9566c
Revises: 211646463e9f
Create Date: 2024-08-05 16:24:26.159323

"""

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 = "db9559f9566c"
down_revision: Union[str, None] = "211646463e9f"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"game7_testnet_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_game7_testnet_labels")),
sa.UniqueConstraint("id", name=op.f("uq_game7_testnet_labels_id")),
)
op.create_index(
"ix_game7_testnet_labels_addr_block_num",
"game7_testnet_labels",
["address", "block_number"],
unique=False,
)
op.create_index(
"ix_game7_testnet_labels_addr_block_ts",
"game7_testnet_labels",
["address", "block_timestamp"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_address"),
"game7_testnet_labels",
["address"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_block_number"),
"game7_testnet_labels",
["block_number"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_caller_address"),
"game7_testnet_labels",
["caller_address"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_label"),
"game7_testnet_labels",
["label"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_label_name"),
"game7_testnet_labels",
["label_name"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_label_type"),
"game7_testnet_labels",
["label_type"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_origin_address"),
"game7_testnet_labels",
["origin_address"],
unique=False,
)
op.create_index(
op.f("ix_game7_testnet_labels_transaction_hash"),
"game7_testnet_labels",
["transaction_hash"],
unique=False,
)
op.create_index(
"uk_game7_testnet_labels_tx_hash_log_idx_evt",
"game7_testnet_labels",
["transaction_hash", "log_index"],
unique=True,
postgresql_where=sa.text("label='seer' and label_type='event'"),
)
op.create_index(
"uk_game7_testnet_labels_tx_hash_log_idx_evt_raw",
"game7_testnet_labels",
["transaction_hash", "log_index"],
unique=True,
postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
)
op.create_index(
"uk_game7_testnet_labels_tx_hash_tx_call",
"game7_testnet_labels",
["transaction_hash"],
unique=True,
postgresql_where=sa.text("label='seer' and label_type='tx_call'"),
)
op.create_index(
"uk_game7_testnet_labels_tx_hash_tx_call_raw",
"game7_testnet_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_game7_testnet_labels_tx_hash_tx_call_raw",
table_name="game7_testnet_labels",
postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
)
op.drop_index(
"uk_game7_testnet_labels_tx_hash_tx_call",
table_name="game7_testnet_labels",
postgresql_where=sa.text("label='seer' and label_type='tx_call'"),
)
op.drop_index(
"uk_game7_testnet_labels_tx_hash_log_idx_evt_raw",
table_name="game7_testnet_labels",
postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
)
op.drop_index(
"uk_game7_testnet_labels_tx_hash_log_idx_evt",
table_name="game7_testnet_labels",
postgresql_where=sa.text("label='seer' and label_type='event'"),
)
op.drop_index(
op.f("ix_game7_testnet_labels_transaction_hash"),
table_name="game7_testnet_labels",
)
op.drop_index(
op.f("ix_game7_testnet_labels_origin_address"),
table_name="game7_testnet_labels",
)
op.drop_index(
op.f("ix_game7_testnet_labels_label_type"), table_name="game7_testnet_labels"
)
op.drop_index(
op.f("ix_game7_testnet_labels_label_name"), table_name="game7_testnet_labels"
)
op.drop_index(
op.f("ix_game7_testnet_labels_label"), table_name="game7_testnet_labels"
)
op.drop_index(
op.f("ix_game7_testnet_labels_caller_address"),
table_name="game7_testnet_labels",
)
op.drop_index(
op.f("ix_game7_testnet_labels_block_number"), table_name="game7_testnet_labels"
)
op.drop_index(
op.f("ix_game7_testnet_labels_address"), table_name="game7_testnet_labels"
)
op.drop_index(
"ix_game7_testnet_labels_addr_block_ts", table_name="game7_testnet_labels"
)
op.drop_index(
"ix_game7_testnet_labels_addr_block_num", table_name="game7_testnet_labels"
)
op.drop_table("game7_testnet_labels")
# ### end Alembic commands ###
8 changes: 8 additions & 0 deletions moonstreamdb-v3/moonstreamdbv3/alembic_indexes/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
Game7OrbitArbitrumSepoliaLogIndex,
Game7OrbitArbitrumSepoliaReorgs,
Game7OrbitArbitrumSepoliaTransactionIndex,
Game7TestnetBlockIndex,
Game7TestnetLogIndex,
Game7TestnetReorgs,
Game7TestnetTransactionIndex,
ImxZkevmBlockIndex,
ImxZkevmLogIndex,
ImxZkevmReorgs,
Expand Down Expand Up @@ -105,6 +109,10 @@ def include_symbol(tablename, schema):
Game7OrbitArbitrumSepoliaTransactionIndex.__tablename__,
Game7OrbitArbitrumSepoliaLogIndex.__tablename__,
Game7OrbitArbitrumSepoliaReorgs.__tablename__,
Game7TestnetBlockIndex.__tablename__,
Game7TestnetTransactionIndex.__tablename__,
Game7TestnetLogIndex.__tablename__,
Game7TestnetReorgs.__tablename__,
MantleBlockIndex.__tablename__,
MantleTransactionIndex.__tablename__,
MantleLogIndex.__tablename__,
Expand Down
Loading
Loading