Add token registry to tasker registry
This commit is contained in:
parent
473ead26f8
commit
3c203851a9
@ -1,11 +1,26 @@
|
|||||||
|
# standard imports
|
||||||
|
import logging
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
from cic_eth_registry import CICRegistry
|
from cic_eth_registry import CICRegistry
|
||||||
from cic_eth_registry.lookup.declarator import AddressDeclaratorLookup
|
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):
|
def connect_declarator(rpc, chain_spec, trusted_addresses):
|
||||||
registry = CICRegistry(chain_spec, rpc)
|
registry = CICRegistry(chain_spec, rpc)
|
||||||
declarator_address = registry.by_name('AddressDeclarator')
|
declarator_address = registry.by_name('AddressDeclarator')
|
||||||
|
logg.debug('using declarator address {}'.format(declarator_address))
|
||||||
lookup = AddressDeclaratorLookup(declarator_address, trusted_addresses)
|
lookup = AddressDeclaratorLookup(declarator_address, trusted_addresses)
|
||||||
CICRegistry.add_lookup(lookup)
|
CICRegistry.add_lookup(lookup)
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ from cic_eth.ext import tx
|
|||||||
from cic_eth.registry import (
|
from cic_eth.registry import (
|
||||||
connect as connect_registry,
|
connect as connect_registry,
|
||||||
connect_declarator,
|
connect_declarator,
|
||||||
|
connect_token_registry,
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
@ -156,6 +157,7 @@ def main():
|
|||||||
for address in trusted_addresses:
|
for address in trusted_addresses:
|
||||||
logg.info('using trusted address {}'.format(address))
|
logg.info('using trusted address {}'.format(address))
|
||||||
connect_declarator(rpc, chain_spec, trusted_addresses)
|
connect_declarator(rpc, chain_spec, trusted_addresses)
|
||||||
|
connect_token_registry(rpc, chain_spec)
|
||||||
|
|
||||||
current_app.worker_main(argv)
|
current_app.worker_main(argv)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user