def create_celery(test_config=None): # pylint: disable=W0603 global web3endpoint, web3, abi_values, eth_abi_values, eth_web3 global solana_client web3endpoint = helpers.get_web3_endpoint(shared_config) web3 = Web3(HTTPProvider(web3endpoint)) abi_values = helpers.load_abi_values() eth_abi_values = helpers.load_eth_abi_values() # Initialize eth_web3 with MultiProvider # We use multiprovider to allow for multiple web3 providers and additional resiliency. # However, we do not use multiprovider in data web3 because of the effect of disparate block status reads. eth_web3 = Web3(MultiProvider(shared_config["web3"]["eth_provider_url"])) # Initialize Solana web3 provider solana_client = Client(SOLANA_ENDPOINT) global registry global user_factory global track_factory global social_feature_factory global playlist_factory global user_library_factory global ipld_blacklist_factory global user_replica_set_manager global contract_addresses # pylint: enable=W0603 (registry, user_factory, track_factory, social_feature_factory, playlist_factory, user_library_factory, ipld_blacklist_factory, user_replica_set_manager, contract_addresses) = init_contracts() return create(test_config, mode="celery")
def create_celery(test_config=None): # pylint: disable=W0603 global web3endpoint, web3, abi_values, eth_abi_values, eth_web3 web3endpoint = helpers.get_web3_endpoint(shared_config) web3 = Web3(HTTPProvider(web3endpoint)) abi_values = helpers.load_abi_values() eth_abi_values = helpers.load_eth_abi_values() # Initialize eth web eth_web3 = Web3(HTTPProvider(shared_config["web3"]["eth_provider_url"])) global registry global user_factory global track_factory global social_feature_factory global playlist_factory global user_library_factory global ipld_blacklist_factory global contract_addresses # pylint: enable=W0603 ( registry, user_factory, track_factory, social_feature_factory, playlist_factory, user_library_factory, ipld_blacklist_factory, contract_addresses ) = initContracts() return create(test_config, mode="celery")
def get_web3(): # pylint: disable=W0603 global web3 if not web3: web3endpoint = helpers.get_web3_endpoint(shared_config) web3 = Web3(HTTPProvider(web3endpoint)) return web3 return web3
import sqlalchemy from flask import Blueprint, jsonify, request from web3 import HTTPProvider, Web3 from src.models import Block from src.utils import helpers from src.utils.db_session import get_db from src.utils.config import shared_config from src.utils.helpers import latest_block_redis_key, latest_block_hash_redis_key logger = logging.getLogger(__name__) bp = Blueprint("health_check", __name__) web3endpoint = helpers.get_web3_endpoint(shared_config) web3 = Web3(HTTPProvider(web3endpoint)) redis_url = shared_config["redis"]["url"] redis = redis.Redis.from_url(url=redis_url) disc_prov_version = helpers.get_discovery_provider_version() HEALTHY_BLOCK_DIFF = 100 #### INTERNAL FUNCTIONS #### # Returns DB block state & diff def _get_db_block_state(latest_blocknum, latest_blockhash): db = get_db() with db.scoped_session() as session:
def get_web3(): web3endpoint = helpers.get_web3_endpoint(shared_config) web3 = Web3(HTTPProvider(web3endpoint)) return web3