Skip to content

Commit

Permalink
Merge pull request #1112 from moonstream-to/add-sepolia
Browse files Browse the repository at this point in the history
Add sepolia and Immutable zkevm
  • Loading branch information
Andrei-Dolgolev authored Jul 25, 2024
2 parents 36b7ca5 + ca8425f commit c7dccce
Show file tree
Hide file tree
Showing 21 changed files with 1,089 additions and 73 deletions.
3 changes: 3 additions & 0 deletions moonstreamapi/configs/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export MOONSTREAM_CRAWLERS_SERVER_PORT="<Moonstream_crawlers_server_port>"
export MOONSTREAM_DATA_JOURNAL_ID="<bugout_journal_id_to_store_blockchain_data>"
export HUMBUG_TXPOOL_CLIENT_ID="<Bugout_Humbug_client_id_for_txpool_transactions_in_journal>"
export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_POLYGON_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
Expand All @@ -36,6 +37,8 @@ export MOONSTREAM_BLAST_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>
export MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
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_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
110 changes: 88 additions & 22 deletions moonstreamapi/moonstreamapi/admin/subscription_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
stripe_price_id=None,
active=True,
),
"sepolia_smartcontract": SubscriptionTypeResourceData(
id="sepolia_smartcontract",
name="Sepolia smartcontracts",
blockchain="sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Sepolia blockchain",
icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"polygon_smartcontract": SubscriptionTypeResourceData(
id="polygon_smartcontract",
name="Polygon smartcontracts",
Expand Down Expand Up @@ -227,6 +238,50 @@
stripe_price_id=None,
active=True,
),
"mantle_smartcontract": SubscriptionTypeResourceData(
id="mantle_smartcontract",
name="Mantle smartcontract",
blockchain="mantle",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Mantle blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/mantle-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"mantle_sepolia_smartcontract": SubscriptionTypeResourceData(
id="mantle_sepolia_smartcontract",
name="Mantle Sepolia smartcontract",
blockchain="mantle_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Mantle Sepolia blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/mantle-sepolia-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"imx_zkevm_smartcontract": SubscriptionTypeResourceData(
id="imx_zkevm_smartcontract",
name="Immutable zkEvm smartcontracts",
blockchain="imx_zkevm",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Immutable zkEvm blockchain",
icon_url="https://static.simiotics.com/moonstream/assets/immutable-zkevm-icon-grey.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"imx_zkevm_sepolia_smartcontract": SubscriptionTypeResourceData(
id="imx_zkevm_sepolia_smartcontract",
name="Immutable zkEvm Sepolia smartcontracts",
blockchain="imx_zkevm_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Immutable zkEvm Sepolia blockchain",
icon_url="https://static.simiotics.com/moonstream/assets/immutable-zkevm-icon-grey.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"ethereum_blockchain": SubscriptionTypeResourceData(
id="ethereum_blockchain",
name="Ethereum transactions",
Expand Down Expand Up @@ -260,28 +315,6 @@
stripe_price_id=None,
active=False,
),
"mantle_smartcontract": SubscriptionTypeResourceData(
id="mantle_smartcontract",
name="Mantle smartcontract",
blockchain="mantle",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Mantle blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/mantle-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"mantle_sepolia_smartcontract": SubscriptionTypeResourceData(
id="mantle_sepolia_smartcontract",
name="Mantle Sepolia smartcontract",
blockchain="mantle_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Mantle Sepolia blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/mantle-sepolia-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"mumbai_blockchain": SubscriptionTypeResourceData(
id="mumbai_blockchain",
name="Mumbai transactions",
Expand Down Expand Up @@ -514,6 +547,39 @@
stripe_price_id=None,
active=False,
),
"sepolia_blockchain": SubscriptionTypeResourceData(
id="sepolia_blockchain",
name="Sepolia transactions",
blockchain="sepolia",
choices=["input:address", "tag:erc721"],
description="Sepolia chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"imx_zkevm_blockchain": SubscriptionTypeResourceData(
id="imx_zkevm_blockchain",
name="Immutable zkEvm transactions",
blockchain="imx_zkevm",
choices=["input:address", "tag:erc721"],
description="Immutable zkEvm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/immutable-zkevm-icon-grey.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"imx_zkevm_sepolia_blockchain": SubscriptionTypeResourceData(
id="imx_zkevm_sepolia_blockchain",
name="Immutable zkEvm Sepolia transactions",
blockchain="imx_zkevm_sepolia",
choices=["input:address", "tag:erc721"],
description="Immutable zkEvm Sepolia chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/immutable-zkevm-icon-grey.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
}


Expand Down
26 changes: 25 additions & 1 deletion moonstreamapi/moonstreamapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@
raise ValueError(
"MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI environment variable must be set"
)

MOONSTREAM_SEPOLIA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_SEPOLIA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_SEPOLIA_WEB3_PROVIDER_URI == "":
raise ValueError(
"MOONSTREAM_SEPOLIA_WEB3_PROVIDER_URI environment variable must be set"
)

MOONSTREAM_POLYGON_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_POLYGON_WEB3_PROVIDER_URI", ""
)
Expand Down Expand Up @@ -159,7 +168,6 @@
"MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI env variable is not set"
)


MOONSTREAM_ARBITRUM_ONE_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_ARBITRUM_ONE_WEB3_PROVIDER_URI", ""
)
Expand Down Expand Up @@ -243,6 +251,22 @@
"MOONSTREAM_MANTLE_SEPOLIA_WEB3_PROVIDER_URI env variable is not set"
)

MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI == "":
raise ValueError(
"MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI environment variable must be set"
)

MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI == "":
raise ValueError(
"MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI environment variable must be 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.4"
MOONSTREAMAPI_VERSION = "0.4.5"
9 changes: 9 additions & 0 deletions moonstreamapi/moonstreamapi/web3_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_BLAST_WEB3_PROVIDER_URI,
MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI,
MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI,
MOONSTREAM_MANTLE_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_MANTLE_WEB3_PROVIDER_URI,
MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI,
MOONSTREAM_POLYGON_WEB3_PROVIDER_URI,
MOONSTREAM_PROOFOFPLAY_APEX_WEB3_PROVIDER_URI,
MOONSTREAM_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_WYRM_WEB3_PROVIDER_URI,
MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_XAI_WEB3_PROVIDER_URI,
Expand Down Expand Up @@ -75,6 +78,8 @@ def connect(
if web3_uri is None:
if blockchain_type == AvailableBlockchainType.ETHEREUM:
web3_uri = MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.SEPOLIA:
web3_uri = MOONSTREAM_SEPOLIA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.POLYGON:
web3_uri = MOONSTREAM_POLYGON_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.MUMBAI:
Expand Down Expand Up @@ -115,6 +120,10 @@ def connect(
web3_uri = MOONSTREAM_MANTLE_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
web3_uri = MOONSTREAM_MANTLE_SEPOLIA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM:
web3_uri = MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
web3_uri = MOONSTREAM_IMX_ZKEVM_SEPOLIA_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.13
moonstreamdb-v3==0.0.15
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.13",
"moonstreamdb-v3>=0.0.15",
"humbug",
"pydantic==1.10.2",
"pyevmasm",
Expand Down
36 changes: 19 additions & 17 deletions moonstreamdb-v3/moonstreamdbv3/alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from logging.config import fileConfig

from sqlalchemy import engine_from_config
from sqlalchemy import pool

from alembic import context
from sqlalchemy import engine_from_config, pool

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand All @@ -27,30 +25,32 @@
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
from moonstreamdbv3.models import (
EthereumLabel,
SepoliaLabel,
PolygonLabel,
MumbaiLabel,
AmoyLabel,
XDaiLabel,
ZkSyncEraLabel,
ZkSyncEraSepoliaLabel,
BaseLabel,
ArbitrumNovaLabel,
ArbitrumOneLabel,
ArbitrumSepoliaLabel,
Game7OrbitArbitrumSepoliaLabel,
XaiLabel,
XaiSepoliaLabel,
AvalancheLabel,
AvalancheFujiLabel,
AvalancheLabel,
BaseLabel,
BlastLabel,
BlastSepoliaLabel,
EthereumLabel,
Game7OrbitArbitrumSepoliaLabel,
ImxZkevmLabel,
ImxZkevmSepoliaLabel,
MantleLabel,
MantleSepoliaLabel,
MumbaiLabel,
PolygonLabel,
ProofOfPlayApexLabel,
SepoliaLabel,
StarknetLabel,
StarknetSepoliaLabel,
MantleLabel,
MantleSepoliaLabel,
XaiLabel,
XaiSepoliaLabel,
XDaiLabel,
ZkSyncEraLabel,
ZkSyncEraSepoliaLabel,
)


Expand Down Expand Up @@ -80,6 +80,8 @@ def include_symbol(tablename, schema):
StarknetSepoliaLabel.__tablename__,
MantleLabel.__tablename__,
MantleSepoliaLabel.__tablename__,
ImxZkevmLabel.__tablename__,
ImxZkevmSepoliaLabel.__tablename__,
}


Expand Down
Loading

0 comments on commit c7dccce

Please sign in to comment.