From 3c203851a9232ce417c7c590b5ddeb33953345b8 Mon Sep 17 00:00:00 2001 From: nolash Date: Tue, 30 Mar 2021 15:04:39 +0200 Subject: [PATCH] Add token registry to tasker registry --- apps/cic-eth/cic_eth/registry.py | 15 +++++++++++++++ apps/cic-eth/cic_eth/runnable/daemons/tasker.py | 2 ++ 2 files changed, 17 insertions(+) diff --git a/apps/cic-eth/cic_eth/registry.py b/apps/cic-eth/cic_eth/registry.py index 5687f8fc..247bf994 100644 --- a/apps/cic-eth/cic_eth/registry.py +++ b/apps/cic-eth/cic_eth/registry.py @@ -1,11 +1,26 @@ +# standard imports +import logging + # external imports from cic_eth_registry import CICRegistry from cic_eth_registry.lookup.declarator import AddressDeclaratorLookup +from cic_eth_registry.lookup.tokenindex import TokenIndexLookup + +logg = logging.getLogger() + + +def connect_token_registry(rpc, chain_spec): + registry = CICRegistry(chain_spec, rpc) + token_registry_address = registry.by_name('TokenRegistry') + logg.debug('using token registry address {}'.format(token_registry_address)) + lookup = TokenIndexLookup(token_registry_address) + CICRegistry.add_lookup(lookup) def connect_declarator(rpc, chain_spec, trusted_addresses): registry = CICRegistry(chain_spec, rpc) declarator_address = registry.by_name('AddressDeclarator') + logg.debug('using declarator address {}'.format(declarator_address)) lookup = AddressDeclaratorLookup(declarator_address, trusted_addresses) CICRegistry.add_lookup(lookup) diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index e75a7820..fd316be0 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -34,6 +34,7 @@ from cic_eth.ext import tx from cic_eth.registry import ( connect as connect_registry, connect_declarator, + connect_token_registry, ) logging.basicConfig(level=logging.WARNING) @@ -156,6 +157,7 @@ def main(): for address in trusted_addresses: logg.info('using trusted address {}'.format(address)) connect_declarator(rpc, chain_spec, trusted_addresses) + connect_token_registry(rpc, chain_spec) current_app.worker_main(argv)