From 9009815d78cbd1b477a2f535d64a0ce70027fd62 Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 14 Oct 2021 21:31:04 +0200 Subject: [PATCH] Add trust address to contract migration config, get cic-eth default token from registry --- apps/cic-eth/cic_eth/runnable/daemons/tasker.py | 10 +++++++--- apps/cic-eth/services_requirements.txt | 2 +- apps/contract-migration/config.sh | 12 +++++++----- apps/contract-migration/config/config.ini | 1 + apps/contract-migration/run_job.sh | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index d9d7a7f8..1e232825 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -76,7 +76,7 @@ arg_flags = cic_eth.cli.argflag_std_read local_arg_flags = cic_eth.cli.argflag_local_task argparser = cic_eth.cli.ArgumentParser(arg_flags) argparser.process_local_flags(local_arg_flags) -argparser.add_argument('--default-token-symbol', dest='default_token_symbol', type=str, help='Symbol of default token to use') +#argparser.add_argument('--default-token-symbol', dest='default_token_symbol', type=str, help='Symbol of default token to use') argparser.add_argument('--trace-queue-status', default=None, dest='trace_queue_status', action='store_true', help='set to perist all queue entry status changes to storage') argparser.add_argument('--aux-all', action='store_true', help='include tasks from all submodules from the aux module path') argparser.add_argument('--aux', action='append', type=str, default=[], help='add single submodule from the aux module path') @@ -84,7 +84,7 @@ args = argparser.parse_args() # process config extra_args = { - 'default_token_symbol': 'CIC_DEFAULT_TOKEN_SYMBOL', +# 'default_token_symbol': 'CIC_DEFAULT_TOKEN_SYMBOL', 'aux_all': None, 'aux': None, 'trace_queue_status': 'TASKS_TRACE_QUEUE_STATUS', @@ -204,7 +204,11 @@ def main(): argv.append('-n') argv.append(config.get('CELERY_QUEUE')) - BaseTask.default_token_symbol = config.get('CIC_DEFAULT_TOKEN_SYMBOL') + default_token_address = registry.by_name('DefaultToken') + c = ERC20Token(chain_spec, conn, default_token_address) + logg.info('found default token {} address {}'.format(c.symbol, default_token_address)) + + BaseTask.default_token_symbol = c.symbol BaseTask.default_token_address = registry.by_name(BaseTask.default_token_symbol) default_token = ERC20Token(chain_spec, conn, add_0x(BaseTask.default_token_address)) default_token.load(conn) diff --git a/apps/cic-eth/services_requirements.txt b/apps/cic-eth/services_requirements.txt index 64b23722..bc929ed8 100644 --- a/apps/cic-eth/services_requirements.txt +++ b/apps/cic-eth/services_requirements.txt @@ -8,7 +8,7 @@ pycryptodome==3.10.1 liveness~=0.0.1a7 eth-address-index>=0.2.3a4,<0.3.0 eth-accounts-index>=0.1.2a3,<0.2.0 -cic-eth-registry>=0.6.1a3,<0.7.0 +cic-eth-registry>=0.6.1a5,<0.7.0 erc20-faucet>=0.3.2a2,<0.4.0 erc20-transfer-authorization>=0.3.5a2,<0.4.0 sarafu-faucet>=0.0.7a2,<0.1.0 diff --git a/apps/contract-migration/config.sh b/apps/contract-migration/config.sh index 04270b04..b740ec38 100644 --- a/apps/contract-migration/config.sh +++ b/apps/contract-migration/config.sh @@ -26,7 +26,8 @@ if [ ! -f $WALLET_KEY_FILE ]; then >&2 echo "wallet path '$WALLET_KEY_FILE' does not point to a file" exit 1 fi -export DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=`eth-checksum $(cat $WALLET_KEY_FILE | jq -r .address)` +#export DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=`eth-checksum $(cat $WALLET_KEY_FILE | jq -r .address)` +export DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=`eth-keyfile -z -d $WALLET_KEY_FILE` # Wallet dependent variable defaults export DEV_ETH_ACCOUNT_RESERVE_MINTER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} @@ -38,9 +39,10 @@ export TOKEN_SINK_ADDRESS=${TOKEN_SINK_ADDRESS:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOY # Migration variable processing confini-dump --schema-dir ./config --prefix export > ${DEV_DATA_DIR}/env_reset -echo "export CIC_TRUST_ADDRESS=$CIC_TRUST_ADDRESS -export CIC_DEFAULT_TOKEN_SYMBOL=$CIC_DEFAULT_TOKEN_SYMBOL -export WALLET_KEY_FILE=$WALLET_KEY_FILE -" >> ${DEV_DATA_DIR}/env_reset + +#echo "export CIC_TRUST_ADDRESS=$CIC_TRUST_ADDRESS +#export CIC_DEFAULT_TOKEN_SYMBOL=$CIC_DEFAULT_TOKEN_SYMBOL +#export WALLET_KEY_FILE=$WALLET_KEY_FILE +#" >> ${DEV_DATA_DIR}/env_reset set +a diff --git a/apps/contract-migration/config/config.ini b/apps/contract-migration/config/config.ini index da6df348..795a0089 100644 --- a/apps/contract-migration/config/config.ini +++ b/apps/contract-migration/config/config.ini @@ -26,3 +26,4 @@ port_callback = [cic] registry_address = +trust_address = diff --git a/apps/contract-migration/run_job.sh b/apps/contract-migration/run_job.sh index 3ca1c530..dfd178c0 100644 --- a/apps/contract-migration/run_job.sh +++ b/apps/contract-migration/run_job.sh @@ -47,7 +47,7 @@ for ((i=0; i<$LAST_BIT_POS; i++)); do exit 1; fi >&2 echo -e "\033[;32mSUCCEEDED $s\033[;39m" - echo -e "\033[;96mConfiguration state after $runlevel execution\033[;39m" + >&2 echo -e "\033[;96mConfiguration state after $runlevel execution\033[;39m" confini-dump --schema-dir ./config fi bit=$((bit*2))