Add eth initializer

This commit is contained in:
nolash
2021-10-18 10:47:48 +02:00
parent 817fc40d84
commit 24e2e62924
11 changed files with 105 additions and 12 deletions

21
cic/ext/eth/start.py Normal file
View File

@@ -0,0 +1,21 @@
# external imports
from cic_eth_registry import CICRegistry
from chainlib.eth.connection import RPCConnection
def extension_start(network, *args, **kwargs):
CICRegistry.address = kwargs['registry_address']
RPCConnection.register_location(kwargs['rpc_provider'], kwargs['chain_spec'])
conn = RPCConnection.connect(kwargs['chain_spec'])
registry = CICRegistry(kwargs['chain_spec'], conn)
address_declarator = registry.by_name('AddressDeclarator')
network.resource_set('eth', 'address_declarator', address_declarator)
token_index = registry.by_name('TokenRegistry')
network.resource_set('eth', 'token_index', token_index)
network.set('eth', kwargs['chain_spec'])
network.save()