From 8f173fa30bff37379e1012c17e3d5b90676d0e4d Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Mon, 12 Jul 2021 19:50:48 +0000 Subject: [PATCH] Add contextual token symbol and name defaults --- apps/contract-migration/reset.sh | 34 +++++++++++++++++++++----------- docker-compose.yml | 4 ++-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index cf8798fe..445b1e95 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -3,14 +3,9 @@ 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_NAME=${TOKEN_NAME} 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 token symbol not set, setting defaults for type $TOKEN_TYPE + TOKEN_SYMBOL="GFT" + TOKEN_NAME="Giftable Token" + elif [ -z "$TOKEN_NAME" ]; then + >&2 echo token name not set, setting same as symbol for type $TOKEN_TYPE + TOKEN_NAME=$TOKEN_SYMBOL + fi >&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 + echo 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 + 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 + if [ -z "$TOKEN_SYMBOL" ]; then + >&2 echo token symbol not set, setting defaults for type $TOKEN_TYPE + TOKEN_SYMBOL="SARAFU" + TOKEN_NAME="Sarafu Token" + elif [ -z "$TOKEN_NAME" ]; then + >&2 echo token name not set, setting same as symbol for type $TOKEN_TYPE + TOKEN_NAME=$TOKEN_SYMBOL + fi >&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` + DEV_RESERVE_ADDRESS=`erc20-demurrage-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC --name "$TOKEN_NAME" --symbol $TOKEN_SYMBOL -vv -ww` else >&2 echo unknown token type $TOKEN_TYPE exit 1 @@ -154,3 +165,4 @@ set +e echo -n 2 > $init_level_file exec "$@" +l:83 diff --git a/docker-compose.yml b/docker-compose.yml index f3f78c80..00e176cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -103,14 +103,14 @@ services: DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0} #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} + CIC_DEFAULT_TOKEN_SYMBOL: $CIC_DEFAULT_TOKEN_SYMBOL TOKEN_NAME: $TOKEN_NAME 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 - TOKEN_TYPE: ${TOKEN_TYPE:-default} + TOKEN_TYPE: $TOKEN_TYPE #CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config} command: ["./run_job.sh"] #command: ["./reset.sh"]