Exemple #1
0
                    broker=config.REDIS_URL,
                    backend=config.REDIS_URL,
                    task_serializer='json')

celery_app.conf.beat_schedule = {
    "maintain_eth_balances": {
        "task": utils.eth_endpoint('topup_wallets'),
        "schedule": 600.0
    },
}

w3 = Web3(HTTPProvider(config.ETH_HTTP_PROVIDER))

red = redis.Redis.from_url(config.REDIS_URL)

persistence_interface = SQLPersistenceInterface(w3=w3, red=red)

blockchain_processor = TransactionProcessor(
    **eth_config,
    w3=w3,
    red=red,
    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'
# )
Exemple #2
0
    from celo_integration import CeloTransactionProcessor

    w3.middleware_onion.inject(geth_poa_middleware, layer=0)
    w3_websocket.middleware_onion.inject(geth_poa_middleware, layer=0)
    w3.eth.account = Account

    TransactionProcessorClass = CeloTransactionProcessor
else:
    TransactionProcessorClass = EthTransactionProcessor

red = redis.Redis.from_url(config.REDIS_URL)

first_block_hash = w3.eth.getBlock(0).hash.hex()

persistence_module = SQLPersistenceInterface(red=red,
                                             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)
Exemple #3
0
def persistence_int(db_session):
    red = redis.Redis.from_url(config.REDIS_URL)

    return SQLPersistenceInterface(
        red=red, session=db_session, first_block_hash='deadbeef01'
    )