From ef1e1658f7e4380a3070e645d7263fd53b70489c Mon Sep 17 00:00:00 2001 From: nolash Date: Sun, 2 May 2021 16:22:17 +0200 Subject: [PATCH] Update contract migrations and cic-cache to chainlib erc20 split --- .../cic_cache/runnable/daemons/filters/erc20.py | 2 +- apps/cic-eth/cic_eth/eth/account.py | 12 ++++++------ apps/cic-eth/cic_eth/ext/address.py | 8 ++++---- apps/cic-eth/docker/Dockerfile | 2 +- apps/contract-migration/docker/Dockerfile | 2 +- apps/contract-migration/seed_cic_eth.sh | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py b/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py index 0dc618e0..e3628b40 100644 --- a/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py +++ b/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py @@ -2,7 +2,6 @@ import logging # external imports -from chainlib.eth.erc20 import ERC20 from chainlib.eth.address import ( to_checksum_address, ) @@ -13,6 +12,7 @@ from cic_eth_registry.error import ( NotAContractError, ContractMismatchError, ) +from eth_erc20 import ERC20 # local imports from .base import TagSyncFilter diff --git a/apps/cic-eth/cic_eth/eth/account.py b/apps/cic-eth/cic_eth/eth/account.py index 46b0060c..dcd9d4dc 100644 --- a/apps/cic-eth/cic_eth/eth/account.py +++ b/apps/cic-eth/cic_eth/eth/account.py @@ -3,7 +3,7 @@ import logging # external imports import celery -from erc20_single_shot_faucet import SingleShotFaucet as Faucet +from erc20_faucet import Faucet from hexathon import ( strip_0x, ) @@ -20,7 +20,7 @@ from chainlib.eth.tx import ( ) from chainlib.chain import ChainSpec from chainlib.error import JSONRPCException -from eth_accounts_index import AccountRegistry +from eth_accounts_index import AccountsIndex from sarafu_faucet import MinterFaucet as Faucet from chainqueue.db.models.tx import TxCache @@ -127,13 +127,13 @@ def register(self, account_address, chain_spec_dict, writer_address=None): if writer_address == ZERO_ADDRESS: session.close() raise RoleMissingError('call address for resgistering {}'.format(account_address)) - account_registry_address = registry.by_name('AccountRegistry', sender_address=call_address) + account_registry_address = registry.by_name('AccountsIndex', sender_address=call_address) # Generate and sign transaction rpc_signer = RPCConnection.connect(chain_spec, 'signer') nonce_oracle = CustodialTaskNonceOracle(writer_address, self.request.root_id, session=session) #, default_nonce) - gas_oracle = self.create_gas_oracle(rpc, AccountRegistry.gas) - account_registry = AccountRegistry(chain_spec, signer=rpc_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle) + gas_oracle = self.create_gas_oracle(rpc, AccountsIndex.gas) + account_registry = AccountsIndex(chain_spec, signer=rpc_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle) (tx_hash_hex, tx_signed_raw_hex) = account_registry.add(account_registry_address, writer_address, account_address, tx_format=TxFormat.RLP_SIGNED) rpc_signer.disconnect() @@ -338,7 +338,7 @@ def cache_account_data( chain_spec = ChainSpec.from_dict(chain_spec_dict) tx_signed_raw_bytes = bytes.fromhex(tx_signed_raw_hex[2:]) tx = unpack(tx_signed_raw_bytes, chain_spec) - tx_data = AccountRegistry.parse_add_request(tx['data']) + tx_data = AccountsIndex.parse_add_request(tx['data']) session = SessionBase.create_session() tx_cache = TxCache( diff --git a/apps/cic-eth/cic_eth/ext/address.py b/apps/cic-eth/cic_eth/ext/address.py index 3db76925..cfb9521c 100644 --- a/apps/cic-eth/cic_eth/ext/address.py +++ b/apps/cic-eth/cic_eth/ext/address.py @@ -7,7 +7,7 @@ from chainlib.chain import ChainSpec from chainlib.connection import RPCConnection from chainlib.eth.constant import ZERO_ADDRESS from cic_eth_registry import CICRegistry -from eth_address_declarator import AddressDeclarator +from eth_address_declarator import Declarator # local imports from cic_eth.task import BaseTask @@ -22,13 +22,13 @@ def translate_address(address, trusted_addresses, chain_spec, sender_address=ZER rpc = RPCConnection.connect(chain_spec, 'default') registry = CICRegistry(chain_spec, rpc) - declarator_address = registry.by_name('AddressDeclarator', sender_address=sender_address) - c = AddressDeclarator(chain_spec) + declarator_address = registry.by_name('Declarator', sender_address=sender_address) + c = Declarator(chain_spec) for trusted_address in trusted_addresses: o = c.declaration(declarator_address, trusted_address, address, sender_address=sender_address) r = rpc.do(o) - declaration_hex = AddressDeclarator.parse_declaration(r) + declaration_hex = Declarator.parse_declaration(r) declaration_hex = declaration_hex[0].rstrip('0') declaration_bytes = bytes.fromhex(declaration_hex) declaration = None diff --git a/apps/cic-eth/docker/Dockerfile b/apps/cic-eth/docker/Dockerfile index 27d8e5c1..163b3016 100644 --- a/apps/cic-eth/docker/Dockerfile +++ b/apps/cic-eth/docker/Dockerfile @@ -29,7 +29,7 @@ RUN /usr/local/bin/python -m pip install --upgrade pip # python merge_requirements.py | tee merged_requirements.txt #RUN cd cic-base && \ # pip install $pip_extra_index_url_flag -r ./merged_requirements.txt -RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2a77 +RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2b8 COPY cic-eth/scripts/ scripts/ COPY cic-eth/setup.cfg cic-eth/setup.py ./ diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index f20b3046..fd94cc83 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -54,8 +54,8 @@ USER grassroots ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 ARG cic_base_version=0.1.2b8 ARG cic_eth_version=0.11.0b12 -ARG sarafu_faucet_version=0.0.3a2 ARG sarafu_token_version=0.0.1a8 +ARG sarafu_faucet_version=0.0.3a2 #ARG cic_contracts_version=0.0.2a2 RUN pip install --user --index-url https://pypi.org/simple --extra-index-url $pip_extra_index_url \ cic-base[full_graph]==$cic_base_version \ diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 5db1e428..fee0d3e5 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -99,7 +99,7 @@ export DEV_ETH_SARAFU_TOKEN_ADDRESS=$DEV_ETH_RESERVE_ADDRESS # Transfer tokens to gifter address >&2 echo "transfer sarafu tokens to token gifter address" ->&2 eth-transfer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --token-address $DEV_RESERVE_ADDRESS -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${token_amount:0:-1} +>&2 erc20-transfer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --token-address $DEV_RESERVE_ADDRESS -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${token_amount:0:-1} #echo -n 0 > $init_level_file