From cf7481ef6685e52424e4d96545a2679d25bc3202 Mon Sep 17 00:00:00 2001 From: nolash Date: Fri, 3 Sep 2021 09:16:08 +0200 Subject: [PATCH] Add demurrage token configuration support to new contract migration config setup --- apps/contract-migration/config.sh | 12 +- apps/contract-migration/config/config.ini | 9 +- apps/contract-migration/reset.sh | 183 +++++++++++----------- apps/contract-migration/seed_cic_eth.sh | 27 ++-- docker-compose.yml | 19 +-- 5 files changed, 127 insertions(+), 123 deletions(-) diff --git a/apps/contract-migration/config.sh b/apps/contract-migration/config.sh index ccea2290..7e80c7e2 100644 --- a/apps/contract-migration/config.sh +++ b/apps/contract-migration/config.sh @@ -15,20 +15,28 @@ if [ -z $DEV_CONFIG_RESET ]; then fi fi +# Handle wallet export WALLET_KEY_FILE=${WALLET_KEY_FILE:-`realpath ./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c`} - 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)` + +# Wallet dependent variable defaults export DEV_ETH_ACCOUNT_RESERVE_MINTER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} export DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} export CIC_TRUST_ADDRESS=${CIC_TRUST_ADDRESS:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} export CIC_DEFAULT_TOKEN_SYMBOL=$TOKEN_SYMBOL +export TOKEN_SINK_ADDRESS=${TOKEN_SINK_ADDRESS:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} +export RPC_PROVIDER=$RPC_HTTP_PROVIDER +# Legacy variable defaults + + +# Migration variable processing + confini-dump --schema-module chainlib.eth.data.config --schema-module cic_eth.data.config --schema-dir ./config --prefix export > ${DEV_DATA_DIR}/env_reset cat ${DEV_DATA_DIR}/env_reset diff --git a/apps/contract-migration/config/config.ini b/apps/contract-migration/config/config.ini index d12a25d2..4bce6a78 100644 --- a/apps/contract-migration/config/config.ini +++ b/apps/contract-migration/config/config.ini @@ -2,6 +2,11 @@ name = Giftable Token symbol = GFT type = giftable_erc20_token +demurrage_level = 196454828847045000000000000000000 +redistribution_period = +supply_limit = +sink_address = + [dev] eth_account_contract_deployer = @@ -13,4 +18,6 @@ gas_amount = 100000000000000000000000 token_amount = 100000000000000000000000 eth_gas_price = data_dir = -pip_extra_index_url = https://pip.grassrootseconomics.net:8433 +pip_extra_index_url = +eth_provider_host = +eth_provider_port = diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index d1a62b9f..1c221021 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -12,106 +12,101 @@ if [ ! -z $DEV_ETH_GAS_PRICE ]; then fi # Wait for the backend to be up, if we know where it is. -if [[ -n "${ETH_PROVIDER}" ]]; then - - export CONFINI_DIR=$_CONFINI_DIR - unset CONFINI_DIR - - if [ ! -z "$DEV_USE_DOCKER_WAIT_SCRIPT" ]; then - echo "waiting for ${ETH_PROVIDER}..." - ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" - fi - - if [ "$TOKEN_TYPE" == "giftable_erc20_token" ]; then - if [ -z "$TOKEN_SYMBOL" ]; then - >&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 - echo giftable-token-deploy $fee_price_arg -p $ETH_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -vv -s -ww --name "$TOKEN_NAME" --symbol $TOKEN_SYMBOL --decimals 6 -vv - DEV_RESERVE_ADDRESS=`giftable-token-deploy $fee_price_arg -p $ETH_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -vv -s -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 $fee_price_arg -p $ETH_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC --name "$TOKEN_NAME" --symbol $TOKEN_SYMBOL -vv -ww -s` - else - >&2 echo unknown token type $TOKEN_TYPE - exit 1 - fi - - echo "giftable-token-gift $fee_price_arg -p $ETH_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -vv -w -e $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT" - giftable-token-gift $fee_price_arg -p $ETH_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -u -vv -s -w -e $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT - - >&2 echo "deploy account index contract" - DEV_ACCOUNT_INDEX_ADDRESS=`eth-accounts-index-deploy $fee_price_arg -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -y $WALLET_KEY_FILE -vv -s -u -w` - >&2 echo "add deployer address as account index writer" - eth-accounts-index-writer $fee_price_arg -s -u -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -e $DEV_ACCOUNT_INDEX_ADDRESS -ww -vv $debug $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER - - >&2 echo "deploy contract registry contract" - CIC_REGISTRY_ADDRESS=`eth-contract-registry-deploy $fee_price_arg -i $CIC_CHAIN_SPEC -y $WALLET_KEY_FILE --identifier AccountRegistry --identifier TokenRegistry --identifier AddressDeclarator --identifier Faucet --identifier TransferAuthorization --identifier ContractRegistry -p $ETH_PROVIDER -vv -s -u -w` - eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv --identifier ContractRegistry $CIC_REGISTRY_ADDRESS - eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv --identifier AccountRegistry $DEV_ACCOUNT_INDEX_ADDRESS - - # Deploy address declarator registry - >&2 echo "deploy address declarator contract" - declarator_description=0x546869732069732074686520434943206e6574776f726b000000000000000000 - DEV_DECLARATOR_ADDRESS=`eth-address-declarator-deploy -s -u -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv $declarator_description` - eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv --identifier AddressDeclarator $DEV_DECLARATOR_ADDRESS - - # Deploy transfer authorization contact - >&2 echo "deploy transfer auth contract" - DEV_TRANSFER_AUTHORIZATION_ADDRESS=`erc20-transfer-auth-deploy $gas_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv` - eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv --identifier TransferAuthorization $DEV_TRANSFER_AUTHORIZATION_ADDRESS - - # Deploy token index contract - >&2 echo "deploy token index contract" - DEV_TOKEN_INDEX_ADDRESS=`eth-token-index-deploy -s -u $fee_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv` - eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv --identifier TokenRegistry $DEV_TOKEN_INDEX_ADDRESS - >&2 echo "add reserve token to token index" - eth-token-index-add $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv -e $DEV_TOKEN_INDEX_ADDRESS $DEV_RESERVE_ADDRESS - - # Sarafu faucet contract - >&2 echo "deploy token faucet contract" - DEV_FAUCET_ADDRESS=`sarafu-faucet-deploy $fee_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv --account-index-address $DEV_ACCOUNT_INDEX_ADDRESS $DEV_RESERVE_ADDRESS -s` - - >&2 echo "set token faucet amount" - sarafu-faucet-set $fee_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -e $DEV_FAUCET_ADDRESS -vv -s --fee-limit 100000 $DEV_FAUCET_AMOUNT - - >&2 echo "register faucet in registry" - eth-contract-registry-set -s -u $fee_price_arg -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv --identifier Faucet $DEV_FAUCET_ADDRESS - - >&2 echo "set faucet as token minter" - giftable-token-minter -s -u $fee_price_arg -w -y $WALLET_KEY_FILE -e $DEV_RESERVE_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv $DEV_FAUCET_ADDRESS - - export CONFINI_DIR=$_CONFINI_DIR -else - echo "\$ETH_PROVIDER not set!" +if [ -z "${RPC_PROVIDER}" ]; then + echo "\$RPC_PROVIDER not set!" exit 1 fi -mkdir -p $DEV_DATA_DIR ->&2 echo using data dir $DEV_DATA_DIR for environment variable dump +unset CONFINI_DIR + +if [ ! -z "$DEV_USE_DOCKER_WAIT_SCRIPT" ]; then + IFS=: read -a p <<< "$RPC_PROVIDER" + read -i "/" rpc_provider_port <<< "${p[2]}" + rpc_provider_host=${p[1]:2} + echo "waiting for provider host $rpc_provider_host port $rpc_provider_port..." + ./wait-for-it.sh "$rpc_provider_host:$rpc_provider_port" +fi + +if [ "$TOKEN_TYPE" == "giftable_erc20_token" ]; then + if [ -z "$TOKEN_SYMBOL" ]; then + >&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 + echo giftable-token-deploy $fee_price_arg -p $RPC_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -vv -s -ww --name "$TOKEN_NAME" --symbol $TOKEN_SYMBOL --decimals 6 -vv + DEV_RESERVE_ADDRESS=`giftable-token-deploy $fee_price_arg -p $RPC_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -vv -s -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="DET" + TOKEN_NAME="Demurrage 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 $fee_price_arg -p $RPC_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC --name "$TOKEN_NAME" --symbol $TOKEN_SYMBOL -vv -ww -s` +else + >&2 echo unknown token type $TOKEN_TYPE + exit 1 +fi + +echo "giftable-token-gift $fee_price_arg -p $RPC_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -vv -w -e $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT" +giftable-token-gift $fee_price_arg -p $RPC_PROVIDER -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -u -vv -s -w -e $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT + +>&2 echo "deploy account index contract" +DEV_ACCOUNT_INDEX_ADDRESS=`eth-accounts-index-deploy $fee_price_arg -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -y $WALLET_KEY_FILE -vv -s -u -w` +>&2 echo "add deployer address as account index writer" +eth-accounts-index-writer $fee_price_arg -s -u -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -e $DEV_ACCOUNT_INDEX_ADDRESS -ww -vv $debug $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER + +>&2 echo "deploy contract registry contract" +CIC_REGISTRY_ADDRESS=`eth-contract-registry-deploy $fee_price_arg -i $CIC_CHAIN_SPEC -y $WALLET_KEY_FILE --identifier AccountRegistry --identifier TokenRegistry --identifier AddressDeclarator --identifier Faucet --identifier TransferAuthorization --identifier ContractRegistry -p $RPC_PROVIDER -vv -s -u -w` +eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv --identifier ContractRegistry $CIC_REGISTRY_ADDRESS +eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv --identifier AccountRegistry $DEV_ACCOUNT_INDEX_ADDRESS + +# Deploy address declarator registry +>&2 echo "deploy address declarator contract" +declarator_description=0x546869732069732074686520434943206e6574776f726b000000000000000000 +DEV_DECLARATOR_ADDRESS=`eth-address-declarator-deploy -s -u -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -w -vv $declarator_description` +eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv --identifier AddressDeclarator $DEV_DECLARATOR_ADDRESS + +# Deploy transfer authorization contact +>&2 echo "deploy transfer auth contract" +DEV_TRANSFER_AUTHORIZATION_ADDRESS=`erc20-transfer-auth-deploy $gas_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -w -vv` +eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv --identifier TransferAuthorization $DEV_TRANSFER_AUTHORIZATION_ADDRESS + +# Deploy token index contract +>&2 echo "deploy token index contract" +DEV_TOKEN_INDEX_ADDRESS=`eth-token-index-deploy -s -u $fee_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -w -vv` +eth-contract-registry-set $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv --identifier TokenRegistry $DEV_TOKEN_INDEX_ADDRESS +>&2 echo "add reserve token to token index" +eth-token-index-add $fee_price_arg -s -u -w -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv -e $DEV_TOKEN_INDEX_ADDRESS $DEV_RESERVE_ADDRESS + +# Sarafu faucet contract +>&2 echo "deploy token faucet contract" +DEV_FAUCET_ADDRESS=`sarafu-faucet-deploy $fee_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -w -vv --account-index-address $DEV_ACCOUNT_INDEX_ADDRESS $DEV_RESERVE_ADDRESS -s` + +>&2 echo "set token faucet amount" +sarafu-faucet-set $fee_price_arg -y $WALLET_KEY_FILE -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -e $DEV_FAUCET_ADDRESS -vv -s --fee-limit 100000 $DEV_FAUCET_AMOUNT + +>&2 echo "register faucet in registry" +eth-contract-registry-set -s -u $fee_price_arg -w -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv --identifier Faucet $DEV_FAUCET_ADDRESS + +>&2 echo "set faucet as token minter" +giftable-token-minter -s -u $fee_price_arg -w -y $WALLET_KEY_FILE -e $DEV_RESERVE_ADDRESS -i $CIC_CHAIN_SPEC -p $RPC_PROVIDER -vv $DEV_FAUCET_ADDRESS + confini-dump --schema-module chainlib.eth.data.config --schema-module cic_eth.data.config --schema-dir ./config --prefix export > ${DEV_DATA_DIR}/env_reset -cat ${DEV_DATA_DIR}/env_reset - set +a set +e diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index bf2f8dc1..36731720 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -2,6 +2,7 @@ # defaults source ${DEV_DATA_DIR}/env_reset +cat ${DEV_DATA_DIR}/env_reset # Debug flag debug='-vv' @@ -10,13 +11,12 @@ empty_config_dir=$CONFINI_DIR/empty set -e set -a -export CONFINI_DIR=$_CONFINI_DIR unset CONFINI_DIR # get required addresses from registries -token_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $ETH_PROVIDER -e $CIC_REGISTRY_ADDRESS -vv --raw TokenRegistry` -account_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $ETH_PROVIDER -e $CIC_REGISTRY_ADDRESS -vv --raw AccountRegistry` -reserve_address=`eth-token-index-list -i $CHAIN_SPEC -u -p $ETH_PROVIDER -e $token_index_address -vv --raw $CIC_DEFAULT_TOKEN_SYMBOL` +token_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $RPC_PROVIDER -e $CIC_REGISTRY_ADDRESS -vv --raw TokenRegistry` +account_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $RPC_PROVIDER -e $CIC_REGISTRY_ADDRESS -vv --raw AccountRegistry` +reserve_address=`eth-token-index-list -i $CHAIN_SPEC -u -p $RPC_PROVIDER -e $token_index_address -vv --raw $CIC_DEFAULT_TOKEN_SYMBOL` >&2 echo "Token registry: $token_index_address" >&2 echo "Account registry: $account_index_address" @@ -46,44 +46,41 @@ cic-eth-tag -i $CHAIN_SPEC TRANSFER_AUTHORIZATION_OWNER $DEV_ETH_ACCOUNT_TRANSFE DEV_ETH_ACCOUNT_ACCOUNT_REGISTRY_WRITER=`CONFINI_DIR=$empty_config_dir cic-eth-create $debug --redis-host $REDIS_HOST --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` cic-eth-tag -i $CHAIN_SPEC ACCOUNT_REGISTRY_WRITER $DEV_ETH_ACCOUNT_ACCOUNT_REGISTRY_WRITER >&2 echo "add acccounts index writer account as writer on contract" -eth-accounts-index-writer -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER -e $account_index_address -ww $debug $DEV_ETH_ACCOUNT_ACCOUNT_REGISTRY_WRITER +eth-accounts-index-writer -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER -e $account_index_address -ww $debug $DEV_ETH_ACCOUNT_ACCOUNT_REGISTRY_WRITER # Transfer gas to custodial gas provider adddress _CONFINI_DIR=$CONFINI_DIR unset CONFINI_DIR >&2 echo gift gas to gas gifter ->&2 eth-gas -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER -w $debug -a $DEV_ETH_ACCOUNT_GAS_GIFTER $DEV_GAS_AMOUNT +>&2 eth-gas -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER -w $debug -a $DEV_ETH_ACCOUNT_GAS_GIFTER $DEV_GAS_AMOUNT >&2 echo gift gas to sarafu token owner ->&2 eth-gas -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER -w $debug -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER $DEV_GAS_AMOUNT +>&2 eth-gas -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER -w $debug -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER $DEV_GAS_AMOUNT >&2 echo gift gas to account index owner ->&2 eth-gas -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER -w $debug -a $DEV_ETH_ACCOUNT_ACCOUNT_REGISTRY_WRITER $DEV_GAS_AMOUNT +>&2 eth-gas -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER -w $debug -a $DEV_ETH_ACCOUNT_ACCOUNT_REGISTRY_WRITER $DEV_GAS_AMOUNT # Send token to token creator >&2 echo "gift tokens to sarafu owner" -echo "giftable-token-gift -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER -e $reserve_address -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER -w $debug $DEV_TOKEN_AMOUNT" ->&2 giftable-token-gift -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER -e $reserve_address -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER -w $debug $DEV_TOKEN_AMOUNT +echo "giftable-token-gift -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER -e $reserve_address -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER -w $debug $DEV_TOKEN_AMOUNT" +>&2 giftable-token-gift -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER -e $reserve_address -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER -w $debug $DEV_TOKEN_AMOUNT # Send token to token gifter >&2 echo "gift tokens to keystore address" ->&2 giftable-token-gift -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER -e $reserve_address -a $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER -w $debug $DEV_TOKEN_AMOUNT +>&2 giftable-token-gift -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER -e $reserve_address -a $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER -w $debug $DEV_TOKEN_AMOUNT >&2 echo "set sarafu token to reserve token (temporarily while bancor contracts are not connected)" export DEV_ETH_SARAFU_TOKEN_ADDRESS=$DEV_ETH_RESERVE_ADDRESS # Transfer tokens to gifter address >&2 echo "transfer tokens to token gifter address" ->&2 erc20-transfer -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $ETH_PROVIDER --fee-limit 100000 -e $reserve_address -w $debug -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${DEV_TOKEN_AMOUNT:0:-1} +>&2 erc20-transfer -s -u -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER --fee-limit 100000 -e $reserve_address -w $debug -a $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${DEV_TOKEN_AMOUNT:0:-1} -#CONFINI_DIR=$_CONFINI_DIR # Remove the SEND (8), QUEUE (16) and INIT (2) locks (or'ed), set by default at migration cic-eth-ctl -i $CHAIN_SPEC unlock INIT cic-eth-ctl -i $CHAIN_SPEC unlock SEND cic-eth-ctl -i $CHAIN_SPEC unlock QUEUE -export CONFINI_DIR=$_CONFINI_DIR - set +a set +e diff --git a/docker-compose.yml b/docker-compose.yml index 4e7ecc94..f0c4ab5c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,12 +73,11 @@ services: # image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/contract-migration:latest environment: CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS - ETH_PROVIDER: ${CIC_HTTP_PROVIDER:-http://eth:8545} - RPC_HTTP_PROVIDER: ${CIC_HTTP_PROVIDER:-http://eth:8545} + RPC_HTTP_PROVIDER: ${RPC_HTTP_PROVIDER:-http://eth:8545} # And these two are for wait-for-it (could parse this) DEV_USE_DOCKER_WAIT_SCRIPT: 1 - ETH_PROVIDER_HOST: eth - ETH_PROVIDER_PORT: 8545 + DEV_ETH_PROVIDER_HOST: eth + DEV_ETH_PROVIDER_PORT: 8545 CHAIN_SPEC: ${CHAIN_SPEC:-evm:bloxberg:8996} CIC_CHAIN_SPEC: ${CHAIN_SPEC:-evm:bloxberg:8996} DEV_DATA_DIR: ${DEV_DATA_DIR:-/tmp/cic/config} @@ -97,17 +96,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} - #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 - TOKEN_NAME: $TOKEN_NAME + DEV_ETH_GAS_PRICE: $DEV_ETH_GAS_PRICE + CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-SARAFU} + TOKEN_NAME: ${TOKEN_NAME:-Sarafu Token} TOKEN_DECIMALS: $TOKEN_DECIMALS - TOKEN_REDISTRIBUTION_PERIOD: $TOKEN_REDISTRIBUTION_PERIOD + TOKEN_REDISTRIBUTION_PERIOD: $TOKEN_DEMURRAGE_REDISTRIBUTION_PERIOD TOKEN_SUPPLY_LIMIT: $TOKEN_SUPPLY_LIMIT - TOKEN_DEMURRAGE_LEVEL: ${TOKEN_DEMURRAGE_LEVEL:-196454828847045000000000000000000} + TOKEN_DEMURRAGE_LEVEL: $TOKEN_DEMURRAGE_LEVEL TOKEN_SINK_ADDRESS: $TOKEN_SINK_ADDRESS TOKEN_TYPE: $TOKEN_TYPE - #CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config} command: ["./run_job.sh"] #command: ["./reset.sh"] depends_on: