From a6fd20124c6ba73c79044a8ef6016af13c6bc783 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 13 Mar 2021 21:31:37 +0100 Subject: [PATCH] WIP receive new registry --- apps/cic-eth/requirements.txt | 1 + apps/cic-eth/tests/conftest.py | 3 ++- apps/cic-eth/tests/fixtures_registry.py | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 3db12ba4..45a3112f 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -23,3 +23,4 @@ chainlib~=0.0.1a25 hexathon~=0.0.1a3 chainsyncer~=0.0.1a19 pysha3==1.0.2 +coincurve==15.0.0 diff --git a/apps/cic-eth/tests/conftest.py b/apps/cic-eth/tests/conftest.py index 47c7e3b4..5c4ed5fd 100644 --- a/apps/cic-eth/tests/conftest.py +++ b/apps/cic-eth/tests/conftest.py @@ -1,13 +1,14 @@ # standard imports import os import sys +import logging script_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = os.path.dirname(script_dir) sys.path.insert(0, root_dir) from tests.fixtures_config import * -from tests.fixtures_chainlib import * from tests.fixtures_celery import * from tests.fixtures_database import * from tests.fixtures_registry import * +from chainlib.pytest.fixtures_ethtester import * diff --git a/apps/cic-eth/tests/fixtures_registry.py b/apps/cic-eth/tests/fixtures_registry.py index 3f9b1d2b..7f0feece 100644 --- a/apps/cic-eth/tests/fixtures_registry.py +++ b/apps/cic-eth/tests/fixtures_registry.py @@ -1,7 +1,29 @@ # external imports import pytest +from cic_registry import CICRegistry from chainlib.chain import ChainSpec +from eth_accounts_index import AccountRegistry @pytest.fixture(scope='session') def default_chain_spec(): return ChainSpec('evm', 'bloxberg', 8996) + + +@pytest.fixture(scope='session') +def accounts_registry( + default_chain_spec, + cic_registry, + ): + #abi = AccountRegistry.abi() + #constructor = w3.eth.contract(abi=abi, bytecode=AccountRegistry.bytecode()) + #tx_hash = constructor.constructor().transact() + r = w3.eth.getTransactionReceipt(tx_hash) + logg.debug('accounts registry deployed {}'.format(r.contractAddress)) + account_registry = AccountRegistry(w3, r.contractAddress) + + c = w3.eth.contract(abi=abi, address=r.contractAddress) + c.functions.addWriter(w3.eth.accounts[0]).transact() + + CICRegistry.add_contract(default_chain_spec, c, 'AccountRegistry') + + return account_registry