feat: add interactive token deployment

This commit is contained in:
2022-02-10 11:22:21 +03:00
parent 1498edbb07
commit d3f65798f1
16 changed files with 720 additions and 141 deletions

View File

@@ -1,6 +1,6 @@
# external imports
from cic_eth_registry import CICRegistry
from chainlib.eth.connection import RPCConnection
from cic_eth_registry import CICRegistry
def extension_start(network, *args, **kwargs):
@@ -9,18 +9,26 @@ def extension_start(network, *args, **kwargs):
:param network: Network object to read and write settings from
:type network: cic.network.Network
"""
CICRegistry.address = kwargs['registry_address']
CICRegistry.address = kwargs["registry_address"]
RPCConnection.register_location(kwargs['rpc_provider'], kwargs['chain_spec'])
conn = RPCConnection.connect(kwargs['chain_spec'])
key_account_address = kwargs["key_account_address"] or ""
registry = CICRegistry(kwargs['chain_spec'], conn)
RPCConnection.register_location(kwargs["rpc_provider"], kwargs["chain_spec"])
conn = RPCConnection.connect(kwargs["chain_spec"])
address_declarator = registry.by_name('AddressDeclarator')
network.resource_set('eth', 'address_declarator', address_declarator)
registry = CICRegistry(kwargs["chain_spec"], conn)
token_index = registry.by_name('TokenRegistry')
network.resource_set('eth', 'token_index', token_index)
address_declarator = registry.by_name("AddressDeclarator")
network.resource_set(
"eth", "address_declarator", address_declarator, key_account=key_account_address
)
network.set('eth', kwargs['chain_spec'])
token_index = registry.by_name("TokenRegistry")
network.resource_set(
"eth", "token_index", token_index, key_account=key_account_address
)
network.resource_set("eth", "token", None, key_account=key_account_address)
network.set("eth", kwargs["chain_spec"])
network.save()