diff --git a/crawlers/mooncrawl/mooncrawl/blockchain.py b/crawlers/mooncrawl/mooncrawl/blockchain.py index ddc93eee..a8c5c724 100644 --- a/crawlers/mooncrawl/mooncrawl/blockchain.py +++ b/crawlers/mooncrawl/mooncrawl/blockchain.py @@ -23,6 +23,7 @@ from .db import yield_db_session, yield_db_session_ctx from .settings import ( MOONSTREAM_CRAWL_WORKERS, MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI, + MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI, MOONSTREAM_NODE_ARBITRUM_NOVA_A_EXTERNAL_URI, MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI, MOONSTREAM_NODE_AVALANCHE_A_EXTERNAL_URI, @@ -76,6 +77,8 @@ def connect( web3_uri = MOONSTREAM_NODE_ZKSYNC_ERA_A_EXTERNAL_URI elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA: web3_uri = MOONSTREAM_NODE_ZKSYNC_ERA_SEPOLIA_A_EXTERNAL_URI + elif blockchain_type == AvailableBlockchainType.ARBITRUM_ONE: + web3_uri = MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA: web3_uri = MOONSTREAM_NODE_ARBITRUM_NOVA_A_EXTERNAL_URI elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA: @@ -179,6 +182,7 @@ def add_block(db_session, block: Any, blockchain_type: AvailableBlockchainType) blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA or blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA or blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX + or blockchain_type == AvailableBlockchainType.ARBITRUM_ONE ): block_obj.sha3_uncles = block.get("sha3Uncles", "") block_obj.l1_block_number = hex_to_int(block.get("l1BlockNumber")) @@ -260,6 +264,7 @@ def add_block_transactions( or blockchain_type == AvailableBlockchainType.XAI or blockchain_type == AvailableBlockchainType.XAI_SEPOLIA or blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX + or blockchain_type == AvailableBlockchainType.ARBITRUM_ONE ): tx_obj.y_parity = hex_to_int(tx.get("yParity")) diff --git a/crawlers/mooncrawl/mooncrawl/settings.py b/crawlers/mooncrawl/mooncrawl/settings.py index f9a16b04..2cc24339 100644 --- a/crawlers/mooncrawl/mooncrawl/settings.py +++ b/crawlers/mooncrawl/mooncrawl/settings.py @@ -188,6 +188,14 @@ if MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI == "": "MOONSTREAM_NODE_PROOFOFPLAY_APEX_A_EXTERNAL_URI env variable is not set" ) +MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI = os.environ.get( + "MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI", "" +) +if MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI == "": + raise Exception( + "MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI env variable is not set" + ) + MOONSTREAM_CRAWL_WORKERS = 4 MOONSTREAM_CRAWL_WORKERS_RAW = os.environ.get("MOONSTREAM_CRAWL_WORKERS") diff --git a/crawlers/mooncrawl/mooncrawl/version.py b/crawlers/mooncrawl/mooncrawl/version.py index 5cfca106..240b2333 100644 --- a/crawlers/mooncrawl/mooncrawl/version.py +++ b/crawlers/mooncrawl/mooncrawl/version.py @@ -2,4 +2,4 @@ Moonstream crawlers version. """ -MOONCRAWL_VERSION = "0.4.4" +MOONCRAWL_VERSION = "0.4.5" diff --git a/crawlers/mooncrawl/sample.env b/crawlers/mooncrawl/sample.env index 88148683..28cb624b 100644 --- a/crawlers/mooncrawl/sample.env +++ b/crawlers/mooncrawl/sample.env @@ -29,6 +29,7 @@ export MOONSTREAM_NODE_AMOY_A_EXTERNAL_URI="https://=0.2.13", "chardet", "fastapi", - "moonstreamdb>=0.4.2", + "moonstreamdb>=0.4.4", "moonstream>=0.1.1", "moonworm[moonstream]>=0.6.2", "humbug", diff --git a/engineapi/engineapi/settings.py b/engineapi/engineapi/settings.py index d5d81b10..3d2450b6 100644 --- a/engineapi/engineapi/settings.py +++ b/engineapi/engineapi/settings.py @@ -99,6 +99,7 @@ blockchain_names = [ "xdai", "zksync_era", "zksync_era_sepolia", + "arbitrum_one", "arbitrum_nova", "arbitrum_sepolia", "xai", diff --git a/moonstreamapi/configs/sample.env b/moonstreamapi/configs/sample.env index e9d6e0c3..824071a8 100644 --- a/moonstreamapi/configs/sample.env +++ b/moonstreamapi/configs/sample.env @@ -25,6 +25,7 @@ export MOONSTREAM_WYRM_WEB3_PROVIDER_URI="https://" export MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI="https://" export MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI="https://" export MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI="https://" +export MOONSTREAM_ARBITRUM_ONE_WEB3_PROVIDER_URI="https://" export MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI="https://" export MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI="https://" export MOONSTREAM_XAI_WEB3_PROVIDER_URI="https://" diff --git a/moonstreamapi/moonstreamapi/admin/subscription_types.py b/moonstreamapi/moonstreamapi/admin/subscription_types.py index ca2f3d30..676d3225 100644 --- a/moonstreamapi/moonstreamapi/admin/subscription_types.py +++ b/moonstreamapi/moonstreamapi/admin/subscription_types.py @@ -128,6 +128,17 @@ CANONICAL_SUBSCRIPTION_TYPES = { stripe_price_id=None, active=True, ), + "arbitrum_one_smartcontract": SubscriptionTypeResourceData( + id="arbitrum_one_smartcontract", + name="Arbitrum One smartcontract", + blockchain="arbitrum_one", + choices=["input:address", "tag:erc721"], + description="Contracts events and tx_calls of contract of Arbitrum One blockchain.", + icon_url="https://static.simiotics.com/moonstream/assets/arbitrum-one-token-logo.png", + stripe_product_id=None, + stripe_price_id=None, + active=True, + ), "arbitrum_nova_smartcontract": SubscriptionTypeResourceData( id="arbitrum_nova_smartcontract", name="Arbitrum Nova smartcontract", @@ -326,6 +337,17 @@ CANONICAL_SUBSCRIPTION_TYPES = { stripe_price_id=None, active=False, ), + "arbitrum_one_blockchain": SubscriptionTypeResourceData( + id="arbitrum_one_blockchain", + name="Arbitrum One transactions", + blockchain="arbitrum_one", + choices=["input:address", "tag:erc721"], + description="Wyrm chain transactions subscription.", + icon_url="https://static.simiotics.com/moonstream/assets/arbitrum-one-token-logo.png", + stripe_product_id=None, + stripe_price_id=None, + active=False, + ), "arbitrum_nova_blockchain": SubscriptionTypeResourceData( id="arbitrum_nova_blockchain", name="Arbitrum Nova transactions", diff --git a/moonstreamapi/moonstreamapi/providers/__init__.py b/moonstreamapi/moonstreamapi/providers/__init__.py index 5baf1461..eab6a2dd 100644 --- a/moonstreamapi/moonstreamapi/providers/__init__.py +++ b/moonstreamapi/moonstreamapi/providers/__init__.py @@ -56,6 +56,7 @@ event_providers: Dict[str, Any] = { moonworm_provider.ZkSyncEraTestnetMoonwormProvider.event_type: moonworm_provider.ZkSyncEraTestnetMoonwormProvider, moonworm_provider.ZkSyncEraMoonwormProvider.event_type: moonworm_provider.ZkSyncEraMoonwormProvider, moonworm_provider.ZkSyncEraSepoliaMoonwormProvider.event_type: moonworm_provider.ZkSyncEraSepoliaMoonwormProvider, + moonworm_provider.ArbitrumOneMoonwormProvider.event_type: moonworm_provider.ArbitrumOneMoonwormProvider, moonworm_provider.ArbitrumNovaMoonwormProvider.event_type: moonworm_provider.ArbitrumNovaMoonwormProvider, moonworm_provider.ArbitrumSepoliaMoonwormProvider.event_type: moonworm_provider.ArbitrumSepoliaMoonwormProvider, moonworm_provider.XaiMoonwormProvider.event_type: moonworm_provider.XaiMoonwormProvider, @@ -73,6 +74,7 @@ event_providers: Dict[str, Any] = { transactions.ZkSyncEraTestnetTransactions.event_type: transactions.ZkSyncEraTestnetTransactions, transactions.ZkSyncEraTransactions.event_type: transactions.ZkSyncEraTransactions, transactions.ZkSyncEraSepoliaTransactions.event_type: transactions.ZkSyncEraSepoliaTransactions, + transactions.ArbitrumOneTransactions.event_type: transactions.ArbitrumOneTransactions, transactions.ArbitrumNovaTransactions.event_type: transactions.ArbitrumNovaTransactions, transactions.ArbitrumSepoliaTransactions.event_type: transactions.ArbitrumSepoliaTransactions, transactions.XaiTransactions.event_type: transactions.XaiTransactions, diff --git a/moonstreamapi/moonstreamapi/providers/moonworm_provider.py b/moonstreamapi/moonstreamapi/providers/moonworm_provider.py index fa59237f..3d14b17c 100644 --- a/moonstreamapi/moonstreamapi/providers/moonworm_provider.py +++ b/moonstreamapi/moonstreamapi/providers/moonworm_provider.py @@ -26,6 +26,7 @@ xdai_event_type = "xdai_blockchain" zksync_era_testnet_event_type = "zksync_era_testnet_blockchain" zksync_era_event_type = "zksync_era_blockchain" zksync_era_sepolia_event_type = "zksync_era_sepolia_blockchain" +arbitrum_one_event_type = "arbitrum_one_blockchain" arbitrum_nova_event_type = "arbitrum_nova_blockchain" arbitrum_sepolia_event_type = "arbitrum_sepolia_blockchain" xai_event_type = "xai_blockchain" @@ -456,6 +457,13 @@ ZkSyncEraSepoliaMoonwormProvider = MoonwormProvider( streamboaundary_range_limit=2 * 60 * 60, ) +ArbitrumOneMoonwormProvider = MoonwormProvider( + event_type="arbitrum_one_smartcontract", + blockchain=AvailableBlockchainType("arbitrum_one"), + description="Provider for reviving transactions from Arbitrum One tables.", + streamboaundary_range_limit=2 * 60 * 60, +) + ArbitrumNovaMoonwormProvider = MoonwormProvider( event_type="arbitrum_nova_smartcontract", blockchain=AvailableBlockchainType("arbitrum_nova"), diff --git a/moonstreamapi/moonstreamapi/providers/transactions.py b/moonstreamapi/moonstreamapi/providers/transactions.py index 3368f01c..1179a243 100644 --- a/moonstreamapi/moonstreamapi/providers/transactions.py +++ b/moonstreamapi/moonstreamapi/providers/transactions.py @@ -504,6 +504,13 @@ ZkSyncEraSepoliaTransactions = TransactionsProvider( streamboaundary_range_limit=2 * 60 * 60, ) +ArbitrumOneTransactions = TransactionsProvider( + event_type="arbitrum_one_blockchain", + blockchain=AvailableBlockchainType("arbitrum_one"), + description="Provider for resiving transactions from Arbitrum One tables.", + streamboaundary_range_limit=2 * 60 * 60, +) + ArbitrumNovaTransactions = TransactionsProvider( event_type="arbitrum_nova_blockchain", blockchain=AvailableBlockchainType("arbitrum_nova"), diff --git a/moonstreamapi/moonstreamapi/settings.py b/moonstreamapi/moonstreamapi/settings.py index ccbb6d79..a8ba7b0d 100644 --- a/moonstreamapi/moonstreamapi/settings.py +++ b/moonstreamapi/moonstreamapi/settings.py @@ -158,6 +158,13 @@ if MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI == "": "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", "" +) +if MOONSTREAM_ARBITRUM_ONE_WEB3_PROVIDER_URI == "": + raise Exception("MOONSTREAM_ARBITRUM_ONE_WEB3_PROVIDER_URI env variable is not set") + MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI = os.environ.get( "MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI", "" ) @@ -274,6 +281,7 @@ multicall_contracts: Dict[AvailableBlockchainType, str] = { AvailableBlockchainType.MUMBAI: "0xe9939e7Ea7D7fb619Ac57f648Da7B1D425832631", AvailableBlockchainType.AMOY: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.ETHEREUM: "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696", + AvailableBlockchainType.ARBITRUM_ONE: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.ARBITRUM_NOVA: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.ARBITRUM_SEPOLIA: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.XAI: "0xcA11bde05977b3631167028862bE2a173976CA11", diff --git a/moonstreamapi/moonstreamapi/web3_provider.py b/moonstreamapi/moonstreamapi/web3_provider.py index cdcdbea2..ca74e014 100644 --- a/moonstreamapi/moonstreamapi/web3_provider.py +++ b/moonstreamapi/moonstreamapi/web3_provider.py @@ -13,6 +13,7 @@ from web3.providers.rpc import HTTPProvider from .settings import ( MOONSTREAM_AMOY_WEB3_PROVIDER_URI, + MOONSTREAM_ARBITRUM_ONE_WEB3_PROVIDER_URI, MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI, MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI, MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI, @@ -88,6 +89,8 @@ def connect( web3_uri = MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA: web3_uri = MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI + elif blockchain_type == AvailableBlockchainType.ARBITRUM_ONE: + web3_uri = MOONSTREAM_ARBITRUM_ONE_WEB3_PROVIDER_URI elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA: web3_uri = MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA: diff --git a/moonstreamapi/requirements.txt b/moonstreamapi/requirements.txt index 60915c97..43553a72 100644 --- a/moonstreamapi/requirements.txt +++ b/moonstreamapi/requirements.txt @@ -37,7 +37,7 @@ lru-dict==1.1.8 Mako==1.2.3 MarkupSafe==2.1.1 moonstream==0.1.1 -moonstreamdb==0.4.2 +moonstreamdb==0.4.4 multiaddr==0.0.9 multidict==6.0.2 netaddr==0.8.0 diff --git a/moonstreamapi/setup.py b/moonstreamapi/setup.py index e3c14220..10b43de9 100644 --- a/moonstreamapi/setup.py +++ b/moonstreamapi/setup.py @@ -16,7 +16,7 @@ setup( "bugout>=0.2.15", "fastapi", "moonstream", - "moonstreamdb>=0.4.2", + "moonstreamdb>=0.4.4", "humbug", "pydantic==1.10.2", "pyevmasm", diff --git a/moonstreamdb/moonstreamdb/blockchain.py b/moonstreamdb/moonstreamdb/blockchain.py index 9bbfa1f0..72d90048 100644 --- a/moonstreamdb/moonstreamdb/blockchain.py +++ b/moonstreamdb/moonstreamdb/blockchain.py @@ -5,6 +5,9 @@ from .models import ( AmoyBlock, AmoyLabel, AmoyTransaction, + ArbitrumOneBlock, + ArbitrumOneLabel, + ArbitrumOneTransaction, ArbitrumNovaBlock, ArbitrumNovaLabel, ArbitrumNovaTransaction, @@ -69,6 +72,7 @@ class AvailableBlockchainType(Enum): ZKSYNC_ERA = "zksync_era" ZKSYNC_ERA_TESTNET = "zksync_era_testnet" ZKSYNC_ERA_SEPOLIA = "zksync_era_sepolia" + ARBITRUM_ONE = "arbitrum_one" ARBITRUM_NOVA = "arbitrum_nova" ARBITRUM_SEPOLIA = "arbitrum_sepolia" XAI = "xai" @@ -93,6 +97,7 @@ def get_block_model( ZkSyncEraTestnetBlock, ZkSyncEraBlock, ZkSyncEraSepoliaBlock, + ArbitrumOneBlock, ArbitrumNovaBlock, ArbitrumSepoliaBlock, XaiBlock, @@ -118,6 +123,7 @@ def get_block_model( ZkSyncEraTestnetBlock, ZkSyncEraBlock, ZkSyncEraSepoliaBlock, + ArbitrumOneBlock, ArbitrumNovaBlock, ArbitrumSepoliaBlock, XaiBlock, @@ -147,6 +153,8 @@ def get_block_model( block_model = ZkSyncEraBlock elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA: block_model = ZkSyncEraSepoliaBlock + elif blockchain_type == AvailableBlockchainType.ARBITRUM_ONE: + block_model = ArbitrumOneBlock elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA: block_model = ArbitrumNovaBlock elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA: @@ -184,6 +192,7 @@ def get_label_model( ZkSyncEraTestnetLabel, ZkSyncEraLabel, ZkSyncEraSepoliaLabel, + ArbitrumOneLabel, ArbitrumNovaLabel, ArbitrumSepoliaLabel, XaiLabel, @@ -209,6 +218,7 @@ def get_label_model( ZkSyncEraTestnetLabel, ZkSyncEraLabel, ZkSyncEraSepoliaLabel, + ArbitrumOneLabel, ArbitrumNovaLabel, ArbitrumSepoliaLabel, XaiLabel, @@ -238,6 +248,8 @@ def get_label_model( label_model = ZkSyncEraLabel elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA: label_model = ZkSyncEraSepoliaLabel + elif blockchain_type == AvailableBlockchainType.ARBITRUM_ONE: + label_model = ArbitrumOneLabel elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA: label_model = ArbitrumNovaLabel elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA: @@ -275,6 +287,7 @@ def get_transaction_model( ZkSyncEraTestnetTransaction, ZkSyncEraTransaction, ZkSyncEraSepoliaTransaction, + ArbitrumOneTransaction, ArbitrumNovaTransaction, ArbitrumSepoliaTransaction, XaiTransaction, @@ -300,6 +313,7 @@ def get_transaction_model( ZkSyncEraTestnetTransaction, ZkSyncEraTransaction, ZkSyncEraSepoliaTransaction, + ArbitrumOneTransaction, ArbitrumNovaTransaction, ArbitrumSepoliaTransaction, XaiTransaction, @@ -329,6 +343,8 @@ def get_transaction_model( transaction_model = ZkSyncEraTransaction elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA: transaction_model = ZkSyncEraSepoliaTransaction + elif blockchain_type == AvailableBlockchainType.ARBITRUM_ONE: + transaction_model = ArbitrumOneTransaction elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA: transaction_model = ArbitrumNovaTransaction elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA: diff --git a/moonstreamdb/moonstreamdb/models.py b/moonstreamdb/moonstreamdb/models.py index dfa09118..b96005c9 100644 --- a/moonstreamdb/moonstreamdb/models.py +++ b/moonstreamdb/moonstreamdb/models.py @@ -2056,6 +2056,121 @@ class ProofOfPlayApexLabel(Base): # type: ignore ) +class ArbitrumOneBlock(Base): # type: ignore + __tablename__ = "arbitrum_one_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 + ) + + sha3_uncles = Column(VARCHAR(256), nullable=True) + l1_block_number = Column(BigInteger, nullable=True) + send_count = Column(BigInteger, nullable=True) + send_root = Column(VARCHAR(256), nullable=True) + mix_hash = Column(VARCHAR(256), nullable=True) + + +class ArbitrumOneTransaction(Base): # type: ignore + __tablename__ = "arbitrum_one_transactions" + + hash = Column( + VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True + ) + block_number = Column( + BigInteger, + ForeignKey("arbitrum_one_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 + ) + + y_parity = Column(BigInteger, nullable=True) + + +class ArbitrumOneLabel(Base): # type: ignore + __tablename__ = "arbitrum_one_labels" + + __table_args__ = ( + Index( + "ix_arbitrum_one_labels_address_block_number", + "address", + "block_number", + unique=False, + ), + Index( + "ix_arbitrum_one_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. diff --git a/moonstreamdb/moonstreamdb/networks.py b/moonstreamdb/moonstreamdb/networks.py index a7cfa2fa..0a4ff1fa 100644 --- a/moonstreamdb/moonstreamdb/networks.py +++ b/moonstreamdb/moonstreamdb/networks.py @@ -6,6 +6,9 @@ from .models import ( AmoyBlock, AmoyLabel, AmoyTransaction, + ArbitrumOneBlock, + ArbitrumOneLabel, + ArbitrumOneTransaction, ArbitrumNovaBlock, ArbitrumNovaLabel, ArbitrumNovaTransaction, @@ -71,6 +74,7 @@ class Network(Enum): zksync_era_testnet = "zksync_era_testnet" zksync_era = "zksync_era" zksync_era_sepolia = "zksync_era_sepolia" + arbitrum_one = "arbitrum_one" arbitrum_nova = "arbitrum_nova" arbitrum_sepolia = "arbitrum_sepolia" xai = "xai" @@ -92,6 +96,7 @@ tx_raw_types = Union[ ZkSyncEraTestnetTransaction, ZkSyncEraTransaction, ZkSyncEraSepoliaTransaction, + ArbitrumOneTransaction, ArbitrumNovaTransaction, ArbitrumSepoliaTransaction, XaiTransaction, @@ -149,6 +154,11 @@ MODELS: Dict[Network, Dict[str, Base]] = { "labels": ZkSyncEraLabel, "transactions": ZkSyncEraTransaction, }, + Network.arbitrum_one: { + "blocks": ArbitrumOneBlock, + "labels": ArbitrumOneLabel, + "transactions": ArbitrumOneTransaction, + }, Network.arbitrum_nova: { "blocks": ArbitrumNovaBlock, "labels": ArbitrumNovaLabel, @@ -218,6 +228,8 @@ def blockchain_type_to_network_type( return Network.zksync_era elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA: return Network.zksync_era_sepolia + elif blockchain_type == AvailableBlockchainType.ARBITRUM_ONE: + return Network.arbitrum_one elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA: return Network.arbitrum_nova elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA: diff --git a/moonstreamdb/moonstreamdb/subscriptions.py b/moonstreamdb/moonstreamdb/subscriptions.py index 3b567249..3a318c38 100644 --- a/moonstreamdb/moonstreamdb/subscriptions.py +++ b/moonstreamdb/moonstreamdb/subscriptions.py @@ -13,6 +13,7 @@ class SubscriptionTypes(Enum): ZKSYNC_ERA_TESTNET_BLOCKCHAIN = "zksync_era_testnet_smartcontract" ZKSYNC_ERA_BLOCKCHAIN = "zksync_era_smartcontract" ZKSYNC_ERA_SEPOLIA_BLOCKCHAIN = "zksync_era_sepolia_smartcontract" + ARBITRUM_ONE_BLOCKCHAIN = "arbitrum_one_smartcontract" ARBITRUM_NOVA_BLOCKCHAIN = "arbitrum_nova_smartcontract" ARBITRUM_SEPOLIA_BLOCKCHAIN = "arbitrum_sepolia_smartcontract" XAI_BLOCKCHAIN = "xai_smartcontract" @@ -45,6 +46,8 @@ def blockchain_type_to_subscription_type( return SubscriptionTypes.ZKSYNC_ERA_BLOCKCHAIN elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA: return SubscriptionTypes.ZKSYNC_ERA_SEPOLIA_BLOCKCHAIN + elif blockchain_type == AvailableBlockchainType.ARBITRUM_ONE: + return SubscriptionTypes.ARBITRUM_ONE_BLOCKCHAIN elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA: return SubscriptionTypes.ARBITRUM_NOVA_BLOCKCHAIN elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA: @@ -77,6 +80,7 @@ subscription_id_by_blockchain = { "zksync_era_testnet": "zksync_era_testnet_smartcontract", "zksync_era": "zksync_era_smartcontract", "zksync_era_sepolia": "zksync_era_sepolia_smartcontract", + "arbitrum_one": "arbitrum_one_smartcontract", "arbitrum_nova": "arbitrum_nova_smartcontract", "arbitrum_sepolia": "arbitrum_sepolia_smartcontract", "xai": "xai_smartcontract", @@ -98,6 +102,7 @@ blockchain_by_subscription_id = { "zksync_era_testnet_blockchain": "zksync_era_testnet", "zksync_era_blockchain": "zksync_era", "zksync_era_sepolia_blockchain": "zksync_era_sepolia", + "arbitrum_one_blockchain": "arbitrum_one", "arbitrum_nova_blockchain": "arbitrum_nova", "arbitrum_sepolia_blockchain": "arbitrum_sepolia", "xai_blockchain": "xai", @@ -116,6 +121,7 @@ blockchain_by_subscription_id = { "zksync_era_testnet_smartcontract": "zksync_era_testnet", "zksync_era_smartcontract": "zksync_era", "zksync_era_sepolia_smartcontract": "zksync_era_sepolia", + "arbitrum_one_smartcontract": "arbitrum_one", "arbitrum_nova_smartcontract": "arbitrum_nova", "arbitrum_sepolia_smartcontract": "arbitrum_sepolia", "xai_smartcontract": "xai", diff --git a/moonstreamdb/moonstreamdb/version.py b/moonstreamdb/moonstreamdb/version.py index 1c9662f8..8ae0f1f3 100644 --- a/moonstreamdb/moonstreamdb/version.py +++ b/moonstreamdb/moonstreamdb/version.py @@ -2,4 +2,4 @@ Moonstream database version. """ -MOONSTREAMDB_VERSION = "0.4.3" +MOONSTREAMDB_VERSION = "0.4.4"