From 72eb61b1c253171babbec1aea42c0c7f91997cdb Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 25 Mar 2021 10:34:53 +0100 Subject: [PATCH] Seed script rehabilitated with chainlib --- apps/cic-eth/requirements.txt | 6 +++--- apps/contract-migration/docker/Dockerfile | 4 ++-- apps/contract-migration/seed_cic_eth.sh | 14 ++++++++------ docker-compose.yml | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index bb7cf281..bfa75b5d 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,9 +1,9 @@ -cic-base~=0.1.2a20 +cic-base~=0.1.2a21 web3==5.12.2 celery==4.4.7 crypto-dev-signer~=0.4.14a8 confini~=0.3.6rc3 -cic-eth-registry~=0.5.4a3 +cic-eth-registry~=0.5.4a4 #cic-bancor~=0.0.6 redis==3.5.3 alembic==1.4.2 @@ -17,7 +17,7 @@ uWSGI==2.0.19.1 semver==2.13.0 websocket-client==0.57.0 moolb~=0.1.1b2 -eth-address-index~=0.1.1a3 +eth-address-index~=0.1.1a4 chainlib~=0.0.1a32 hexathon~=0.0.1a5 chainsyncer~=0.0.1a20 diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index 2fe3ef73..ee3e0627 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -57,8 +57,8 @@ WORKDIR /home/grassroots USER grassroots ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 -ARG cic_base_version=0.1.2a19 -ARG cic_eth_version=0.10.1a5+build.8675b1a2 +ARG cic_base_version=0.1.2a20 +ARG cic_eth_version=0.10.1a5+build.5bf30afb ARG cic_contracts_version=0.0.2a2 RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version \ cic-eth==$cic_eth_version \ diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 1d134772..b8a733b7 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -12,6 +12,7 @@ source ${CIC_DATA_DIR}/.env_all DEV_PIP_EXTRA_INDEX_URL=${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"} CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic} +ETH_PASSPHRASE='' # Debug flag DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C @@ -26,11 +27,12 @@ env_out_file=${CIC_DATA_DIR}/.env_seed init_level_file=${CIC_DATA_DIR}/.init truncate $env_out_file -s 0 -#pip install --extra-index-url https://pip.grassrootseconomics.net:8433 chainlib==0.0.1a22 - set -e set -a +#pip install --extra-index-url https://pip.grassrootseconomics.net:8433 chainlib==0.0.1a22 +pip install --extra-index-url https://pip.grassrootseconomics.net:8433 eth-address-index==0.1.1a4 chainlib==0.0.1a33 + # get required addresses from registries DEV_TOKEN_INDEX_ADDRESS=`eth-contract-registry-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_REGISTRY_ADDRESS -f brief TokenRegistry` DEV_RESERVE_ADDRESS=`eth-token-index-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_TOKEN_INDEX_ADDRESS -f brief SRF` @@ -63,13 +65,13 @@ cic-eth-tag -i $CIC_CHAIN_SPEC ACCOUNTS_INDEX_WRITER $DEV_ETH_ACCOUNT_ACCOUNTS_I # Transfer gas to custodial gas provider adddress >&2 echo gift gas to gas gifter ->&2 eth-gas -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_GAS_GIFTER $gas_amount +>&2 eth-gas --send -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_GAS_GIFTER $gas_amount >&2 echo gift gas to sarafu token owner ->&2 eth-gas -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER $gas_amount +>&2 eth-gas --send -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER $gas_amount >&2 echo gift gas to account index owner ->&2 eth-gas -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER $gas_amount +>&2 eth-gas --send -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER $gas_amount # Send token to token creator @@ -86,7 +88,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_ETH_SARAFU_TOKEN_ADDRESS --abi-dir $abi_dir -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${token_amount:0:-1} +>&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} #echo -n 0 > $init_level_file diff --git a/docker-compose.yml b/docker-compose.yml index b3d80a88..bf3163f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -101,7 +101,7 @@ services: CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379} CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis:6379} DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} - RUN_MASK: 2 #0: noop 1: contract migrations 2: seed data + RUN_MASK: 3 #0: noop 1: contract migrations 2: seed data command: ["./run_job.sh"] #command: ["./reset.sh"] depends_on: