def test_create_blockchain_wallet_from_private_key( self, db_session, persistence_module: SQLPersistenceInterface): from utils import keypair kp = keypair() trans = persistence_module.create_blockchain_wallet_from_private_key( kp['pk']) assert trans.address == kp['address']
session=session, first_block_hash=first_block_hash) processor = TransactionProcessorClass( ethereum_chain_id=chain_config['CHAIN_ID'], gas_price_wei=w3.toWei(chain_config['GAS_PRICE'], 'gwei'), gas_limit=chain_config['GAS_LIMIT'], w3=w3, persistence=persistence_module) supervisor = TransactionSupervisor(red=red, persistence=persistence_module, processor=processor) task_manager = TaskManager(persistence=persistence_module, transaction_supervisor=supervisor) blockchain_sync = BlockchainSyncer(persistence=persistence_module, red=red, w3_websocket=w3_websocket) if os.environ.get('CONTAINER_TYPE') == 'PRIMARY': persistence_module.create_blockchain_wallet_from_private_key( chain_config['MASTER_WALLET_PRIVATE_KEY'], allow_existing=True) processor.registry.register_abi('ERC20', erc20_abi.abi) processor.registry.register_abi('bancor_converter', bancor_converter_abi.abi) processor.registry.register_abi('bancor_network', bancor_network_abi.abi) import celery_tasks
persistence_interface=persistence_interface ) import eth_manager.celery_tasks # # blockchain_processor.registry.register_contract( # config.ETH_CONTRACT_ADDRESS, # dai_abi.abi, # contract_name='Dai Stablecoin v1.0' # ) # Register the master wallet so we can use it for tasks if os.environ.get('CONTAINER_TYPE') == 'PRIMARY': persistence_interface.create_blockchain_wallet_from_private_key( config.MASTER_WALLET_PRIVATE_KEY, allow_existing=True ) def register_tokens_from_app(host_address, auth_username, auth_password): token_req = requests.get(host_address + '/api/token', auth=HTTPBasicAuth(auth_username, auth_password)) if token_req.status_code == 200: for token in token_req.json()['data']['tokens']: try: blockchain_processor.registry.register_contract(token['address'], dai_abi.abi) except BadFunctionCallOutput as e: # It's probably a contract on a different chain if not config.IS_PRODUCTION: pass