From a74e69aeb3c64294f054687d847ce06225eb154b Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 5 Jun 2021 17:06:13 +0200 Subject: [PATCH 1/6] Introduce dev dockerfile for contract migration enabling faster iteration in dev --- apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-eth/requirements.txt | 6 +- apps/contract-migration/docker/Dockerfile | 15 ++- apps/contract-migration/docker/Dockerfile.dev | 93 +++++++++++++++++++ .../override_requirements.txt | 3 + apps/contract-migration/requirements.txt | 9 +- apps/contract-migration/reset.sh | 29 ++++-- docker-compose.yml | 13 ++- 8 files changed, 148 insertions(+), 22 deletions(-) create mode 100644 apps/contract-migration/docker/Dockerfile.dev create mode 100644 apps/contract-migration/override_requirements.txt diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 0edda257..fd65bab3 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.16', + 'beta.17', ) version_object = semver.VersionInfo( diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 3f56ce0c..ac143555 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base~=0.1.2b15 +cic-base~=0.1.2b17 celery==4.4.7 crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 @@ -18,8 +18,8 @@ chainlib~=0.0.3rc2 hexathon~=0.0.1a7 chainsyncer[sql]~=0.0.2a5 chainqueue~=0.0.2b3 -sarafu-faucet==0.0.3a3 -erc20-faucet==0.2.1a4 +sarafu-faucet~=0.0.3a4 +erc20-faucet~=0.2.1a4 coincurve==15.0.0 potaahto~=0.0.1a2 pycryptodome==3.10.1 diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index a15ac1c8..6aa16479 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -22,7 +22,7 @@ COPY contract-migration/nvm.sh . ENV CONFINI_DIR /usr/local/etc/cic/ RUN mkdir -vp $CONFINI_DIR -ARG cic_config_commit=35c69ba75f00c8147150acf325565d5391cf25bf +ARG cic_config_commit=0abe0867f18077907c7023bf0ef5e466a3984dd8 ARG cic_config_url=https://gitlab.com/grassrootseconomics/cic-config.git/ RUN echo Install confini schema files && \ git clone --depth 1 $cic_config_url cic-config && \ @@ -56,7 +56,9 @@ COPY contract-migration/requirements.txt . ARG pip_extra_args="" ARG pip_index_url=https://pypi.org/simple ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 -RUN pip install --index-url https://pypi.org/simple \ +ARG pip_trusted_host=pypi.org +RUN pip install --index-url $pip_index_url \ + --trusted-host $pip_trusted_host \ --extra-index-url $pip_extra_index_url -r requirements.txt # -------------- begin runtime container ---------------- @@ -97,4 +99,13 @@ RUN chmod gu+x *.sh # USER grassroots +ARG pip_index_url=https://pypi.org/simple +ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 +ARG pip_trusted_host=pypi.org +COPY contract-migration/override_requirements.txt . +RUN pip install --index-url $pip_index_url \ + --force-reinstall \ + --trusted-host $pip_trusted_host \ + --extra-index-url $pip_extra_index_url -r override_requirements.txt + ENTRYPOINT [ ] diff --git a/apps/contract-migration/docker/Dockerfile.dev b/apps/contract-migration/docker/Dockerfile.dev new file mode 100644 index 00000000..2d8a76fa --- /dev/null +++ b/apps/contract-migration/docker/Dockerfile.dev @@ -0,0 +1,93 @@ +# syntax = docker/dockerfile:1.2 +FROM python:3.8.6-slim-buster as compile-image + +RUN apt-get update +RUN apt-get install -y --no-install-recommends git gcc g++ libpq-dev gawk jq telnet wget openssl iputils-ping gnupg socat bash procps make python2 cargo + +RUN touch /etc/apt/sources.list.d/ethereum.list +RUN echo 'deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' > /etc/apt/sources.list.d/ethereum.list +RUN echo 'deb-src http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' >> /etc/apt/sources.list.d/ethereum.list + +RUN cat etc/apt/sources.list.d/ethereum.list +RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2A518C819BE37D2C2031944D1C52189C923F6CA9 + +RUN apt-get update +RUN apt-get install solc +RUN pip install --upgrade pip + +WORKDIR /root +RUN mkdir -vp /usr/local/etc/cic + +COPY contract-migration/nvm.sh . +ENV CONFINI_DIR /usr/local/etc/cic/ +RUN mkdir -vp $CONFINI_DIR + +ARG cic_config_commit=0abe0867f18077907c7023bf0ef5e466a3984dd8 +ARG cic_config_url=https://gitlab.com/grassrootseconomics/cic-config.git/ +RUN echo Install confini schema files && \ + git clone --depth 1 $cic_config_url cic-config && \ + cd cic-config && \ + git fetch --depth 1 origin $cic_config_commit && \ + git checkout $cic_config_commit && \ + cp -v *.ini $CONFINI_DIR + +# Install nvm with node and npm +# https://stackoverflow.com/questions/25899912/how-to-install-nvm-in-docker +ENV NVM_DIR /root/.nvm +ENV NODE_VERSION 15.3.0 +ENV BANCOR_NODE_VERSION 10.16.0 + +RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use $NODE_VERSION +# && chown -R root:root "$NVM_DIR/versions/node/v$NODE_VERSION" + +ENV NODE_PATH $NVM_DIR/versions/node//v$NODE_VERSION/lib/node_modules +ENV PATH $NVM_DIR/versions/node//v$NODE_VERSION/bin:$PATH + +#RUN useradd --create-home grassroots +# WORKDIR /home/grassroots +# USER grassroots + +COPY contract-migration/requirements.txt . + +ARG pip_extra_args="" +ARG pip_index_url=https://pypi.org/simple +ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 +ARG pip_trusted_host=pypi.org +RUN pip install --index-url $pip_index_url \ + --trusted-host $pip_trusted_host \ + --extra-index-url $pip_extra_index_url -r requirements.txt + +COPY contract-migration/testdata/pgp testdata/pgp +COPY contract-migration/sarafu_declaration.json sarafu_declaration.json +COPY contract-migration/keystore keystore +COPY contract-migration/envlist . + +# A shared output dir for environment configs +RUN mkdir -p /tmp/cic/config +# RUN chown grassroots:grassroots /tmp/cic/config +RUN chmod a+rwx /tmp/cic/config + +COPY contract-migration/*.sh ./ +# RUN chown grassroots:grassroots -R . +RUN chmod gu+x *.sh + +# we copied these from the root build container. +# this is dumb though...I guess the compile image should have the same user +# RUN chown grassroots:grassroots -R /usr/local/lib/python3.8/site-packages/ + +# USER grassroots + +ARG pip_index_url=https://pypi.org/simple +ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 +ARG pip_trusted_host=pypi.org +COPY contract-migration/override_requirements.txt . +RUN pip install --index-url $pip_index_url \ + --force-reinstall \ + --trusted-host $pip_trusted_host \ + --extra-index-url $pip_extra_index_url -r override_requirements.txt + +ENTRYPOINT [ ] diff --git a/apps/contract-migration/override_requirements.txt b/apps/contract-migration/override_requirements.txt new file mode 100644 index 00000000..62ba7a71 --- /dev/null +++ b/apps/contract-migration/override_requirements.txt @@ -0,0 +1,3 @@ +erc20-demurrage-token==0.0.1b1 + + diff --git a/apps/contract-migration/requirements.txt b/apps/contract-migration/requirements.txt index 291ced7a..64ae898f 100644 --- a/apps/contract-migration/requirements.txt +++ b/apps/contract-migration/requirements.txt @@ -1,4 +1,5 @@ - cic-base[full_graph]==0.1.2b15 - sarafu-faucet==0.0.3a3 - sarafu-token==0.0.1a8 - cic-eth==0.11.0b16 +cic-base[full_graph]==0.1.2b17 +sarafu-faucet~=0.0.3a4 +erc20-demurrage-token==0.0.1b1 +cic-eth~=0.11.0b16 + diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 4ecf2fba..ac8c8b65 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -2,14 +2,26 @@ set -a +cat <&2 echo using static gas price $DEV_ETH_GAS_PRICE fi -if [[ $CIC_DEFAULT_TOKEN_SYMBOL != 'GFT' && $CIC_DEFAULT_TOKEN_SYMBOL != 'SRF' ]]; then - >&2 echo CIC_DEFAULT_TOKEN_SYMBOL must be one of [GFT,SRF], but was $CIC_DEFAULT_TOKEN_SYMBOL +if [[ $TOKEN_SYMBOL != 'GFT' && $TOKEN_SYMBOL != 'SRF' ]]; then + >&2 echo TOKEN_SYMBOL must be one of [GFT,SRF], but was $TOKEN_SYMBOL exit 1 fi @@ -60,17 +72,16 @@ if [[ -n "${ETH_PROVIDER}" ]]; then ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" fi - if [ $CIC_DEFAULT_TOKEN_SYMBOL == 'GFT' ]; then + if [ $TOKEN_SYMBOL == 'GFT' ]; then >&2 echo "deploying 'giftable token'" - DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Giftable Token" --symbol "GFT" --decimals 6 -vv` + DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww --name "Giftable Token" --symbol "GFT" --decimals 6 -vv` else - >&2 echo "deploying 'sarafu' token'" - DEV_RESERVE_ADDRESS=`sarafu-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Sarafu" --decimals 6 -vv SRF $DEV_SARAFU_DEMURRAGE_LEVEL` + >&2 echo "deploying 'redistributed demurrage token'" + DEV_RESERVE_ADDRESS=`erc20-demurrage-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww` fi + exit 0 giftable-token-gift $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT - #BANCOR_REGISTRY_ADDRESS=`cic-bancor-deploy $gas_price_arg --bancor-dir /usr/local/share/cic/bancor -z $DEV_ETH_RESERVE_ADDRESS -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER` - >&2 echo "deploy account index contract" DEV_ACCOUNT_INDEX_ADDRESS=`eth-accounts-index-deploy $gas_price_arg -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -vv -w` >&2 echo "add deployer address as account index writer" diff --git a/docker-compose.yml b/docker-compose.yml index a6a4ba89..50b64013 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,11 +72,11 @@ services: contract-migration: build: + dockerfile: contract-migration/docker/Dockerfile.dev args: pip_index_url: ${PIP_DEFAULT_INDEX_URL:-https://pypi.org/simple} pip_extra_args: $PIP_EXTRA_ARGS context: apps/ - dockerfile: contract-migration/docker/Dockerfile # image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/contract-migration:latest environment: # ETH_PROVIDER should be broken out into host/port but cic-eth expects this @@ -101,9 +101,16 @@ services: DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} RUN_MASK: ${RUN_MASK:-0} # bit flags; 1: contract migrations 2: seed data DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0} - CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} - DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000} + #CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} + #DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000} DEV_ETH_GAS_PRICE: ${DEV_ETH_GAS_PRICE:-1} + TOKEN_NAME: $TOKEN_NAME + TOKEN_SYMBOL: $TOKEN_SYMBOL + TOKEN_DECIMALS: $TOKEN_DECIMALS + TOKEN_REDISTRIBUTION_PERIOD: $TOKEN_REDISTRIBUTION_PERIOD + TOKEN_SUPPLY_LIMIT: $TOKEN_SUPPLY_LIMIT + TOKEN_DEMURRAGE_LEVEL: ${TOKEN_DEMURRAGE_LEVEL:-196454828847045000000000000000000} + CONFINI_DIR: $CONFINI_DIR command: ["./run_job.sh"] #command: ["./reset.sh"] depends_on: From 4dc8dff3692775955edb5de5f83e5f6a54319d1f Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 5 Jun 2021 17:13:14 +0200 Subject: [PATCH 2/6] Remove foo --- apps/contract-migration/reset.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index ac8c8b65..6a2ea7ec 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -20,8 +20,6 @@ DEV_RESERVE_AMOUNT=${DEV_ETH_RESERVE_AMOUNT:-""100000000000000000000000000000000 DEV_FAUCET_AMOUNT=${DEV_FAUCET_AMOUNT:-0} DEV_ETH_KEYSTORE_FILE=${DEV_ETH_KEYSTORE_FILE:-`realpath ./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c`} -foo=${TOKEN_SUPPLY_LIMIT-foo} -echo foo $foo set -e DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=`eth-checksum $(cat $DEV_ETH_KEYSTORE_FILE | jq -r .address)` From ba0dc9371e15f4c1596d83f2d90d73e61a0aeef3 Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 10 Jun 2021 07:16:59 +0200 Subject: [PATCH 3/6] Add colors to run script for contract migrations --- apps/contract-migration/override_requirements.txt | 6 +++--- apps/contract-migration/requirements.txt | 7 +++---- apps/contract-migration/reset.sh | 1 - apps/contract-migration/run_job.sh | 11 ++++++++++- docker-compose.yml | 3 ++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/apps/contract-migration/override_requirements.txt b/apps/contract-migration/override_requirements.txt index 62ba7a71..4f423706 100644 --- a/apps/contract-migration/override_requirements.txt +++ b/apps/contract-migration/override_requirements.txt @@ -1,3 +1,3 @@ -erc20-demurrage-token==0.0.1b1 - - +eth-contract-registry==0.5.5a3 +erc20-demurrage-token==0.0.1b4 +eth-address-index==0.1.1a12 diff --git a/apps/contract-migration/requirements.txt b/apps/contract-migration/requirements.txt index 64ae898f..01b7e1a9 100644 --- a/apps/contract-migration/requirements.txt +++ b/apps/contract-migration/requirements.txt @@ -1,5 +1,4 @@ -cic-base[full_graph]==0.1.2b17 +cic-base[full]==0.1.2b18 sarafu-faucet~=0.0.3a4 -erc20-demurrage-token==0.0.1b1 -cic-eth~=0.11.0b16 - +cic-eth~=0.11.0b17 +erc20-demurrage-token==0.0.1b4 diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 6a2ea7ec..5f5ec43b 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -77,7 +77,6 @@ if [[ -n "${ETH_PROVIDER}" ]]; then >&2 echo "deploying 'redistributed demurrage token'" DEV_RESERVE_ADDRESS=`erc20-demurrage-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww` fi - exit 0 giftable-token-gift $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT >&2 echo "deploy account index contract" diff --git a/apps/contract-migration/run_job.sh b/apps/contract-migration/run_job.sh index 9c4c61b6..5edb2b00 100644 --- a/apps/contract-migration/run_job.sh +++ b/apps/contract-migration/run_job.sh @@ -2,13 +2,22 @@ if [[ $((RUN_MASK & 1)) -eq 1 ]] then + >&2 echo -e "\033[;96mRUNNING\033[;39m RUN_MASK 1 - contract deployment" ./reset.sh if [ $? -ne "0" ]; then - exit 1; + >&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 1 - contract deployment" + exit 1; fi + >&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 1 - contract deployment" fi if [[ $((RUN_MASK & 2)) -eq 2 ]] then + >&2 echo -e "\033[;96mRUNNING\033[;39m RUN_MASK 2 - custodial service initialization" ./seed_cic_eth.sh + if [ $? -ne "0" ]; then + >&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 2 - custodial service initialization" + exit 1; + fi + >&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 2 - custodial service initialization" fi diff --git a/docker-compose.yml b/docker-compose.yml index 50b64013..71e4e593 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,6 +73,7 @@ services: contract-migration: build: dockerfile: contract-migration/docker/Dockerfile.dev + #dockerfile: contract-migration/docker/Dockerfile args: pip_index_url: ${PIP_DEFAULT_INDEX_URL:-https://pypi.org/simple} pip_extra_args: $PIP_EXTRA_ARGS @@ -110,7 +111,7 @@ services: TOKEN_REDISTRIBUTION_PERIOD: $TOKEN_REDISTRIBUTION_PERIOD TOKEN_SUPPLY_LIMIT: $TOKEN_SUPPLY_LIMIT TOKEN_DEMURRAGE_LEVEL: ${TOKEN_DEMURRAGE_LEVEL:-196454828847045000000000000000000} - CONFINI_DIR: $CONFINI_DIR + #CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config} command: ["./run_job.sh"] #command: ["./reset.sh"] depends_on: From b0638f2262c23ce4abf008df27f8c78dbbbf1b5d Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 30 Jun 2021 21:16:06 +0200 Subject: [PATCH 4/6] Rename env var for token symbol in contract migration --- apps/contract-migration/override_requirements.txt | 6 +++--- apps/contract-migration/requirements.txt | 8 ++++---- apps/contract-migration/reset.sh | 9 ++++++++- apps/contract-migration/seed_cic_eth.sh | 5 +++-- apps/util/requirements/update_base.sh | 11 ++++++++--- docker-compose.yml | 4 ++-- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/apps/contract-migration/override_requirements.txt b/apps/contract-migration/override_requirements.txt index 4f423706..5c78ae38 100644 --- a/apps/contract-migration/override_requirements.txt +++ b/apps/contract-migration/override_requirements.txt @@ -1,3 +1,3 @@ -eth-contract-registry==0.5.5a3 -erc20-demurrage-token==0.0.1b4 -eth-address-index==0.1.1a12 +#eth-contract-registry==0.5.5a3 +#erc20-demurrage-token==0.0.1b4 +#eth-address-index==0.1.1a12 diff --git a/apps/contract-migration/requirements.txt b/apps/contract-migration/requirements.txt index 01b7e1a9..42ecafa5 100644 --- a/apps/contract-migration/requirements.txt +++ b/apps/contract-migration/requirements.txt @@ -1,4 +1,4 @@ -cic-base[full]==0.1.2b18 -sarafu-faucet~=0.0.3a4 -cic-eth~=0.11.0b17 -erc20-demurrage-token==0.0.1b4 +cic_base[full]==0.1.3a3+build.4aa03607 +sarafu-faucet~=0.0.4a1 +cic-eth~=0.11.1a2 +erc20-demurrage-token==0.0.2a1 diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 708f3809..a1af35e9 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -1,11 +1,15 @@ #!/bin/bash set -a +echo fuck you $CIC_DEFAULT_TOKEN_SYMBOL +CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} +echo fuck you $CIC_DEFAULT_TOKEN_SYMBOL +TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL} cat <&2 echo "deploying 'redistributed demurrage token'" + if [ -z $TOKEN_SINK_ADDRESS && ! -z $TOKEN_REDISTRIBUTION_PERIOD ]; then + >&2 echo -e "\033[;93mtoken sink address not set, so redistribution will be BURNED\033[;39m" + fi DEV_RESERVE_ADDRESS=`erc20-demurrage-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww` fi giftable-token-gift $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 505857ee..6d4c3365 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -14,6 +14,7 @@ DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"} CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic} ETH_PASSPHRASE='' CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} +TOKEN_SYMBOL=$CIC_DEFAULT_TOKEN_SYMBOL if [[ $CIC_DEFAULT_TOKEN_SYMBOL != 'GFT' && $CIC_DEFAULT_TOKEN_SYMBOL != 'SRF' ]]; then >&2 echo CIC_DEFAULT_TOKEN_SYMBOL must be one of [GFT,SRF], but was $CIC_DEFAULT_TOKEN_SYMBOL exit 1 @@ -98,8 +99,8 @@ echo DEV_ETH_SARAFU_TOKEN_ADDRESS=$DEV_ETH_RESERVE_ADDRESS >> $env_out_file 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 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} +>&2 echo "transfer tokens to token gifter address" +>&2 erc20-transfer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --gas-limit 100000 --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/apps/util/requirements/update_base.sh b/apps/util/requirements/update_base.sh index 938867be..e1abf720 100644 --- a/apps/util/requirements/update_base.sh +++ b/apps/util/requirements/update_base.sh @@ -9,13 +9,18 @@ fi t=$(mktemp) >&2 echo using tmp $t -repos=(../../cic-cache ../../cic-eth ../../cic-ussd ../../data-seeding ../../cic-notify) +repos=(../../cic-cache ../../cic-eth ../../cic-ussd ../../data-seeding ../../cic-notify ../../contract-migration) for r in ${repos[@]}; do f="$r/requirements.txt" >&2 echo updating $f - f="$r/test_requirements.txt" - >&2 echo updating $f pyreq-update $f base_requirement.txt > $t cp $t $f + + f="$r/test_requirements.txt" + if [ -f $f ]; then + >&2 echo updating $f + pyreq-update $f base_requirement.txt > $t + cp $t $f + fi done diff --git a/docker-compose.yml b/docker-compose.yml index 8d65dd9c..68dcf0eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -102,15 +102,15 @@ services: DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} RUN_MASK: ${RUN_MASK:-0} # bit flags; 1: contract migrations 2: seed data DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0} - #CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} #DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000} DEV_ETH_GAS_PRICE: ${DEV_ETH_GAS_PRICE:-1} + CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} TOKEN_NAME: $TOKEN_NAME - TOKEN_SYMBOL: $TOKEN_SYMBOL TOKEN_DECIMALS: $TOKEN_DECIMALS TOKEN_REDISTRIBUTION_PERIOD: $TOKEN_REDISTRIBUTION_PERIOD TOKEN_SUPPLY_LIMIT: $TOKEN_SUPPLY_LIMIT TOKEN_DEMURRAGE_LEVEL: ${TOKEN_DEMURRAGE_LEVEL:-196454828847045000000000000000000} + TOKEN_SINK_ADDRESS: $TOKEN_SINK_ADDRESS #CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config} command: ["./run_job.sh"] #command: ["./reset.sh"] From 98a38b71175cec2495123c7411b3fe8887fb3614 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 30 Jun 2021 22:51:23 +0200 Subject: [PATCH 5/6] Upgrade cic-base for contract-migration --- apps/contract-migration/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contract-migration/requirements.txt b/apps/contract-migration/requirements.txt index 42ecafa5..6cd247c3 100644 --- a/apps/contract-migration/requirements.txt +++ b/apps/contract-migration/requirements.txt @@ -1,4 +1,4 @@ -cic_base[full]==0.1.3a3+build.4aa03607 +cic_base[full]==0.1.3a3+build.984b5cff sarafu-faucet~=0.0.4a1 cic-eth~=0.11.1a2 erc20-demurrage-token==0.0.2a1 From 9b2f2ab0b1388bdc6c5d77a3fe8a3e46579998dd Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 1 Jul 2021 11:05:31 +0200 Subject: [PATCH 6/6] Reduce profanity --- apps/contract-migration/reset.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index a1af35e9..9a9f5318 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -1,10 +1,8 @@ #!/bin/bash set -a -echo fuck you $CIC_DEFAULT_TOKEN_SYMBOL CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} -echo fuck you $CIC_DEFAULT_TOKEN_SYMBOL TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL} cat <