From ed029a936c506a976d637143aacc9179d9c9cffd Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Wed, 7 Jul 2021 07:56:45 +0000 Subject: [PATCH] Add explicit token type toggle in contract migration --- .../override_requirements.txt | 2 +- apps/contract-migration/requirements.txt | 7 ++-- apps/contract-migration/reset.sh | 32 ++++++++++++------- docker-compose.yml | 2 ++ 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/apps/contract-migration/override_requirements.txt b/apps/contract-migration/override_requirements.txt index 5c78ae38..8f1b185c 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 +#erc20-demurrage-token==0.0.2a3 #eth-address-index==0.1.1a12 diff --git a/apps/contract-migration/requirements.txt b/apps/contract-migration/requirements.txt index 6cd247c3..c622ddc7 100644 --- a/apps/contract-migration/requirements.txt +++ b/apps/contract-migration/requirements.txt @@ -1,4 +1,5 @@ -cic_base[full]==0.1.3a3+build.984b5cff +cic_base[full]==0.1.3a4+build.ce68c833 sarafu-faucet~=0.0.4a1 -cic-eth~=0.11.1a2 -erc20-demurrage-token==0.0.2a1 +cic-eth==0.11.1a3+build.a3c49324 +eth-erc20~=0.0.10a3 +erc20-demurrage-token==0.0.2a3 diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 9a9f5318..cf8798fe 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -2,10 +2,18 @@ set -a +default_token=giftable_erc20_token CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL} +TOKEN_NAME=${TOKEN_NAME:-$TOKEN_SYMBOL} +TOKEN_TYPE=${TOKEN_TYPE:-$default_token} +if [ $TOKEN_TYPE == 'default' ]; then + >&2 echo resolving "default" token to $default_token + TOKEN_TYPE=$default_token +fi cat <&2 echo using static gas price $DEV_ETH_GAS_PRICE fi -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 - echo "environment:" printenv echo \n @@ -72,15 +75,20 @@ if [[ -n "${ETH_PROVIDER}" ]]; then ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" fi - 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 -ww --name "Giftable Token" --symbol "GFT" --decimals 6 -vv` - else - >&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" + if [ $TOKEN_TYPE == $default_token ]; then + >&2 echo deploying default token $TOKEN_TYPE + DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww --name $TOKEN_NAME --symbol $TOKEN_SYMBOL --decimals 6 -vv` + elif [ $TOKEN_TYPE == 'erc20_demurrage_token' ]; then + >&2 echo deploying token $TOKEN_TYPE + if [ -z $TOKEN_SINK_ADDRESS ]; then + if [ ! -z $TOKEN_REDISTRIBUTION_PERIOD ]; then + >&2 echo -e "\033[;93mtoken sink address not set, so redistribution will be BURNED\033[;39m" + fi 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` + else + >&2 echo unknown token type $TOKEN_TYPE + exit 1 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/docker-compose.yml b/docker-compose.yml index d2d4d081..4ece0564 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,6 +73,7 @@ services: contract-migration: build: dockerfile: contract-migration/docker/Dockerfile + # target: compile-image args: pip_index_url: ${PIP_DEFAULT_INDEX_URL:-https://pypi.org/simple} pip_extra_args: $PIP_EXTRA_ARGS @@ -110,6 +111,7 @@ services: TOKEN_SUPPLY_LIMIT: $TOKEN_SUPPLY_LIMIT TOKEN_DEMURRAGE_LEVEL: ${TOKEN_DEMURRAGE_LEVEL:-196454828847045000000000000000000} TOKEN_SINK_ADDRESS: $TOKEN_SINK_ADDRESS + TOKEN_TYPE: ${TOKEN_TYPE:-default} #CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config} command: ["./run_job.sh"] #command: ["./reset.sh"]