def create_celery(test_config=None): # pylint: disable=W0603 global web3endpoint, web3, abi_values web3endpoint = helpers.get_web3_endpoint(shared_config) web3 = Web3(HTTPProvider(web3endpoint)) abi_values = helpers.loadAbiValues() 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 contracts(app): # pylint: disable=redefined-outer-name # Create web3 provider to real ganache web3endpoint = "http://{}:{}".format(app.config["web3"]["host"], app.config["web3"]["port"]) web3 = Web3(HTTPProvider(web3endpoint)) # set pre-funded account as sender web3.eth.defaultAccount = web3.eth.accounts[0] registry_address = web3.toChecksumAddress( app.config["contracts"]["registry"]) abi_values = helpers.loadAbiValues() registry_return_val = web3.eth.contract(address=registry_address, abi=abi_values["Registry"]["abi"]) user_factory_address = registry_return_val.functions.getContract( bytes("UserFactory", "utf-8")).call() track_factory_address = registry_return_val.functions.getContract( bytes("TrackFactory", "utf-8")).call() user_factory_contract = web3.eth.contract( address=user_factory_address, abi=abi_values["UserFactory"]["abi"]) track_factory_contract = web3.eth.contract( address=track_factory_address, abi=abi_values["TrackFactory"]["abi"]) return { "abi_values": abi_values, "registry_address": registry_address, "user_factory_address": user_factory_address, "user_factory_contract": user_factory_contract, "track_factory_address": track_factory_address, "track_factory_contract": track_factory_contract, "web3": web3, }