From 74e57b89ec13f835d0f55bf25e11dd93a6b0289f Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Wed, 10 Feb 2021 07:03:11 +0000 Subject: [PATCH] Add cic-eth and auxiliary contract seeding script --- apps/cic-eth/cic_eth/runnable/create.py | 49 +++--- apps/cic-eth/cic_eth/runnable/tasker.py | 5 + apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-eth/docker/db.sh | 4 +- apps/cic-eth/docker/start_tasker.sh | 2 + apps/contract-migration/docker/Dockerfile | 11 +- apps/contract-migration/from_env.sh | 9 ++ apps/contract-migration/reset.sh | 26 +++- .../sarafu_declaration.json | 18 +++ apps/contract-migration/seed_cic_eth.sh | 142 ++++++++++++++++++ docker-compose.yml | 46 +++++- 11 files changed, 276 insertions(+), 38 deletions(-) create mode 100644 apps/contract-migration/from_env.sh create mode 100644 apps/contract-migration/sarafu_declaration.json create mode 100644 apps/contract-migration/seed_cic_eth.sh diff --git a/apps/cic-eth/cic_eth/runnable/create.py b/apps/cic-eth/cic_eth/runnable/create.py index 8802549f..5514abce 100644 --- a/apps/cic-eth/cic_eth/runnable/create.py +++ b/apps/cic-eth/cic_eth/runnable/create.py @@ -51,27 +51,34 @@ args_override = { config.dict_override(args_override, 'cli') celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL')) -redis_host = config.get('REDIS_HOST') -redis_port = config.get('REDIS_PORT') -redis_db = config.get('REDIS_DB') -redis_channel = str(uuid.uuid4()) -r = redis.Redis(redis_host, redis_port, redis_db) -ps = r.pubsub() -ps.subscribe(redis_channel) -ps.get_message() -api = Api( - config.get('CIC_CHAIN_SPEC'), - queue=args.q, - callback_param='{}:{}:{}:{}'.format(args.redis_host_callback, args.redis_port_callback, redis_db, redis_channel), - callback_task='cic_eth.callbacks.redis.redis', - callback_queue=args.q, - ) +def main(): + redis_host = config.get('REDIS_HOST') + redis_port = config.get('REDIS_PORT') + redis_db = config.get('REDIS_DB') + redis_channel = str(uuid.uuid4()) + r = redis.Redis(redis_host, redis_port, redis_db) -register = not args.no_register -logg.debug('register {}'.format(register)) -t = api.create_account(register=register) + ps = r.pubsub() + ps.subscribe(redis_channel) + ps.get_message() -ps.get_message() -m = ps.get_message(timeout=args.timeout) -print(json.loads(m['data'])) + api = Api( + config.get('CIC_CHAIN_SPEC'), + queue=args.q, + callback_param='{}:{}:{}:{}'.format(args.redis_host_callback, args.redis_port_callback, redis_db, redis_channel), + callback_task='cic_eth.callbacks.redis.redis', + callback_queue=args.q, + ) + + register = not args.no_register + logg.debug('register {}'.format(register)) + t = api.create_account(register=register) + + ps.get_message() + m = ps.get_message(timeout=args.timeout) + print(json.loads(m['data'])) + + +if __name__ == '__main__': + main() diff --git a/apps/cic-eth/cic_eth/runnable/tasker.py b/apps/cic-eth/cic_eth/runnable/tasker.py index efbb6e75..9e75166f 100644 --- a/apps/cic-eth/cic_eth/runnable/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/tasker.py @@ -211,6 +211,11 @@ def main(): chain_registry = ChainRegistry(chain_spec) CICRegistry.add_chain_registry(chain_registry, True) + try: + CICRegistry.get_contract(chain_spec, 'CICRegistry') + except Exception as e: + logg.exception('Eek, registry failureĀ is baaad juju {}'.format(e)) + sys.exit(1) if config.get('ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER') != None: CICRegistry.add_role(chain_spec, config.get('ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER'), 'AccountRegistry', True) diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 41d70b6a..c529d5e7 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 10, 0, - 'alpha.24', + 'alpha.25', ) version_object = semver.VersionInfo( diff --git a/apps/cic-eth/docker/db.sh b/apps/cic-eth/docker/db.sh index bc239cf6..cbeb2ea3 100644 --- a/apps/cic-eth/docker/db.sh +++ b/apps/cic-eth/docker/db.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -e +>&2 echo executing database migration migrate.py -c /usr/local/etc/cic-eth --migrations-dir /usr/local/share/cic-eth/alembic -vv - +set +e diff --git a/apps/cic-eth/docker/start_tasker.sh b/apps/cic-eth/docker/start_tasker.sh index 0dc729ac..61ea1e06 100644 --- a/apps/cic-eth/docker/start_tasker.sh +++ b/apps/cic-eth/docker/start_tasker.sh @@ -1,5 +1,6 @@ #!/bin/bash +set -e . ./db.sh # set CONFINI_ENV_PREFIX to override the env prefix to override env vars @@ -27,3 +28,4 @@ while true; do sleep 15; done +set +e diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index 7dfdd93e..8ecb10cf 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -10,7 +10,7 @@ RUN apk update && \ WORKDIR /usr/src -ARG cic_config_commit=6c5bda473d3806844696d5716845d51416ed1b47 +ARG cic_config_commit=35c69ba75f00c8147150acf325565d5391cf25bf 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 && \ @@ -106,7 +106,7 @@ RUN cd cic-bancor/python && \ pip install --extra-index-url $pip_extra_index_url . RUN echo installing common python tooling -ARG cic_python_commit=a684ed3450a31f349ce1d860dfe3b8607f15bbe2 +ARG cic_python_commit=beecee783ceac2ea0fa711f888ce4c82f1a81490 ARG cic_python_url=https://gitlab.com/grassrootseconomics/cic-python.git/ RUN echo Install sum of python dependencies across all components && \ git clone --depth 1 $cic_python_url cic-python && \ @@ -132,11 +132,11 @@ RUN pip install --extra-index-url $pip_extra_index_url erc20-approval-escrow==$e ARG erc20_single_shot_faucet_version=0.2.0a5 RUN pip install --extra-index-url $pip_extra_index_url erc20-single-shot-faucet==$erc20_single_shot_faucet_version -ARG eth_address_index_version==0.1.0a6 +ARG eth_address_index_version==0.1.0a8 RUN pip install --extra-index-url $pip_extra_index_url eth-address-index==$eth_address_index_version RUN echo Install cic specific python packages -ARG cic_registry_version=0.5.3a10 +ARG cic_registry_version=0.5.3a11 RUN pip install --extra-index-url $pip_extra_index_url cic-registry==$cic_registry_version RUN echo Install misc helpers @@ -157,6 +157,9 @@ RUN chmod +x ./wait-for-it.sh # COPY contract-migration/.env_dockercompose_template .env_dockercompose_template COPY contract-migration/reset.sh reset.sh +COPY contract-migration/from_env.sh from_env.sh +COPY contract-migration/seed_cic_eth.sh seed_cic_eth.sh +COPY contract-migration/sarafu_declaration.json sarafu_declaration.json COPY contract-migration/keystore keystore LABEL version="4" diff --git a/apps/contract-migration/from_env.sh b/apps/contract-migration/from_env.sh new file mode 100644 index 00000000..f815bb45 --- /dev/null +++ b/apps/contract-migration/from_env.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +while read l; do + e=${!l} + if [ ! -z $e ]; then + >&2 echo "saving env var $l = $e" + echo "$l=$e" + fi +done diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 4ccbfcca..360c4f78 100644 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -1,5 +1,11 @@ #!/bin/bash +set -a + +DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C +DEV_ETH_ACCOUNT_RESERVE_MINTER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} +DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} +DEV_ETH_RESERVE_AMOUNT=${DEV_ETH_RESERVE_AMOUNT:-""10000000000000000000000000000000000} keystore_file=$(realpath ./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c) echo "environment:" @@ -12,7 +18,8 @@ echo \n # define these parameters at runtime # pushd /usr/src -#!/bin/sh +init_level_file=${CIC_DATA_DIR}/.init +echo -n 0 > $init_level_file # Abort on any error (including if wait-for-it fails). set -e @@ -22,8 +29,7 @@ if [[ -n "${ETH_PROVIDER}" ]]; then echo "waiting for ${ETH_PROVIDER}..." ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" - #DEV_ETH_RESERVE_ADDRESS=`giftable-token-deploy -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_RESERVE_OWNER -m $DEV_ETH_ACCOUNT_RESERVE_MINTER $DEV_ETH_RESERVE_AMOUNT` - DEV_ETH_RESERVE_ADDRESS=`giftable-token-deploy -p $ETH_PROVIDER -y $keystore_file -i $CIC_CHAIN_SPEC --minter $DEV_ETH_ACCOUNT_RESERVE_MINTER -v -w --name "Sarafu" --symbol "SRF" $DEV_ETH_RESERVE_AMOUNT` + DEV_ETH_RESERVE_ADDRESS=`giftable-token-deploy -p $ETH_PROVIDER -y $keystore_file -i $CIC_CHAIN_SPEC --account $DEV_ETH_ACCOUNT_RESERVE_MINTER --minter $DEV_ETH_ACCOUNT_RESERVE_MINTER -v -w --name "Sarafu" --symbol "SRF" $DEV_ETH_RESERVE_AMOUNT` #BANCOR_REGISTRY_ADDRESS=`cic-bancor-deploy --bancor-dir /usr/local/share/cic/bancor -z $DEV_ETH_RESERVE_ADDRESS -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER` @@ -33,6 +39,12 @@ if [[ -n "${ETH_PROVIDER}" ]]; then cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -k CICRegistry -p $ETH_PROVIDER $CIC_REGISTRY_ADDRESS -vv #cic-registry-set -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -k BancorRegistry -p $ETH_PROVIDER $BANCOR_REGISTRY_ADDRESS -vv cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -k AccountRegistry -p $ETH_PROVIDER $CIC_ACCOUNTS_INDEX_ADDRESS -vv + + # Deploy address declarator registry + >&2 echo "deploy address declarator contract" + declarator_description=0x546869732069732074686520434943206e6574776f726b000000000000000000 + CIC_DECLARATOR_ADDRESS=`eth-address-declarator-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -v $declarator_description` + else echo "\$ETH_PROVIDER not set!" exit 1 @@ -44,12 +56,18 @@ mkdir -p $CIC_DATA_DIR cat << EOF > $CIC_DATA_DIR/.env export DEV_ETH_RESERVE_ADDRESS=$DEV_ETH_RESERVE_ADDRESS export DEV_ETH_RESERVE_AMOUNT=$DEV_ETH_RESERVE_AMOUNT -export DEV_ETH_ACCOUNTS_INDEX_ADDRESS=$DEV_ETH_ACCOUNTS_INDEX_ADDRESS +export DEV_ETH_ACCOUNTS_INDEX_ADDRESS=$CIC_ACCOUNTS_INDEX_ADDRESS export BANCOR_REGISTRY_ADDRESS=$BANCOR_REGISTRY_ADDRESS export CIC_REGISTRY_ADDRESS=$CIC_REGISTRY_ADDRESS EOF +cat $CIC_DATA_DIR/envlist | bash from_env.sh > $CIC_DATA_DIR/.env_all # popd +set +a +set +e + +echo -n 1 > $init_level_file + exec "$@" diff --git a/apps/contract-migration/sarafu_declaration.json b/apps/contract-migration/sarafu_declaration.json new file mode 100644 index 00000000..ff0745dd --- /dev/null +++ b/apps/contract-migration/sarafu_declaration.json @@ -0,0 +1,18 @@ +{ + "objectType": "ERC20", + "content": { + { + "tokenlists": { + "logoURI": "data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAIAAAAHjs1qAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw1AUhU9Ti1IqDnYQcchQnSyIiuimVShChVArtOpg8tI/aNKQpLg4Cq4FB38Wqw4uzro6uAqC4A+Im5uToouUeF9SaBHjhcf7OO+ew3v3AUKjwjSrawzQdNtMJxNiNrcqdr8igBDCmEFYZpYxJ0kp+NbXPXVT3c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vgpahqZ6Oho4dO+47eABZgVhYqlKJ0WPGnE5NpU3ZiYGDBqWdPweug+6fxKa3Teq5dJ8pU6g9qVpaAYGBJ5JOdu/eHeYUkpnPk5aa+mP4moaGBsr1vFOnTtuiouhdPwOiu4bx8vY+d/HCqNGjqRS6WKzJPj7nM34D1yG6q8nV3NwNa9eRW4pMGfr17792/boBAwfClIHubaKpqSnhcPyumBihUNgOu2dsbPzDypU+U6doacF3NeiuId7U1SUeTUyIj28/JWvMzMz8FsyfOnWaPlcfJgh01zxikehU8qlDBw/WVFeT2A1rG+sFC/0nenmy2WyYFNCdWGRS6eXLl9PPns25nI3ysZSBgcGYsWM9vb2HDhvKYrFgIkB3pAiFwqyMzHPp6fl5eWqfX/BZOByOq5vbBM+Jrm5uHA4HLjvoTjINDQ03S0uLC4uKior+VVbWdvV1dXXtBwxwcnZydHIaMHCgrq4uXGTQvZ3m92VlZZUVlZWVlVVVlVWVVdWPHrV+2rWenp65ubk5n8+34PMtLKysrPrb2uro6MDFBN2ph0KhEIvEQpFQ2CAUiYRCoZDF0uJy9fX1uVwDLldfX1dPD3Jx0B0ANAk8mABAdwAA3QEAdAcA0B0AQHcAAN0BAHQHANAdAEB3AADdAQB0B0B3AADdAQB0BwDQHQDaI/8PQ8+qzeC911gAAAAASUVORK5CYII=", + "tags": [ + "cic", + "bancor" + ] + }, + "logo": { + "sha256": "6d36122bf05c4ebe483a1be281b5b524e4d2d6df4607fe31e80ccdc430ea981d", + "bzz": "7fa223e40ebdc1691253775abdf96d2289e6fc8ef8f0775e318071744b691e87" + } + } + } +} diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh new file mode 100644 index 00000000..8559a9ce --- /dev/null +++ b/apps/contract-migration/seed_cic_eth.sh @@ -0,0 +1,142 @@ +#!/bin/bash + +# defaults +source ${CIC_DATA_DIR}/.env +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} + +# Debug flag +#debug='-v' +DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C +keystore_file=./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c +debug='-vv' +abi_dir=${ETH_ABI_DIR:-/usr/local/share/cic/solidity/abi} +gas_amount=100000000000000000000000 +token_amount=${gas_amount} +faucet_amount=1000000000 +env_out_file=${CIC_DATA_DIR}/.env_seed +init_level_file=${CIC_DATA_DIR}/.init +truncate $env_out_file -s 0 + + +set -e +set -a + +pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a25 cic-tools==0.0.1a4 + +>&2 echo "create account for gas gifter" +old_gas_provider=$DEV_ETH_ACCOUNT_GAS_PROVIDER +DEV_ETH_ACCOUNT_GAS_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` +echo DEV_ETH_ACCOUNT_GAS_GIFTER=$DEV_ETH_ACCOUNT_GAS_GIFTER >> $env_out_file +cic-eth-tag GAS_GIFTER $DEV_ETH_ACCOUNT_GAS_GIFTER + +>&2 echo "create account for sarafu gifter" +DEV_ETH_ACCOUNT_SARAFU_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` +echo DEV_ETH_ACCOUNT_SARAFU_GIFTER=$DEV_ETH_ACCOUNT_SARAFU_GIFTER >> $env_out_file +cic-eth-tag SARAFU_GIFTER $DEV_ETH_ACCOUNT_SARAFU_GIFTER + +>&2 echo "create account for approval escrow owner" +DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` +echo DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER=$DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER >> $env_out_file +cic-eth-tag TRANSFER_AUTHORIZATION_OWNER $DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER + +>&2 echo "create account for faucet owner" +DEV_ETH_ACCOUNT_FAUCET_OWNER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` +echo DEV_ETH_ACCOUNT_GAS_GIFTER=$DEV_ETH_ACCOUNT_FAUCET_OWNER >> $env_out_file +cic-eth-tag FAUCET_GIFTER $DEV_ETH_ACCOUNT_FAUCET_OWNER + +>&2 echo "create account for accounts index owner" +DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` +echo DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=$DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER >> $env_out_file +cic-eth-tag ACCOUNTS_INDEX_WRITER $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER + + +# 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 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 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 + +# Send token to token creator +>&2 echo "gift tokens to sarafu owner" +>&2 giftable-token-gift -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_ETH_RESERVE_ADDRESS --recipient $DEV_ETH_ACCOUNT_SARAFU_GIFTER -w $debug $token_amount + +# Send token to token gifter +>&2 echo "gift tokens to keystore address" +>&2 giftable-token-gift -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_ETH_RESERVE_ADDRESS --recipient $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER -w $debug $token_amount + + +>&2 echo "set sarafu token to reserve token (temporarily while bancor contracts are not connected)" +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 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 echo "deploy transfer authorization contract" +CIC_TRANSFER_AUTHORIZATION_ADDRESS=`erc20-approval-escrow-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --approver $DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER -w $debug` +echo CIC_APPROVAL_ESCROW_ADDRESS=$CIC_TRANSFER_AUTHORIZATION_ADDRESS >> $env_out_file +export CIC_TRANSFER_AUTHORIZATION_ADDRESS=$CIC_TRANSFER_AUTHORIZATION_ADDRESS + +# Register transfer approval contract +>&2 echo "add transfer approval request contract to registry" +>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k TransferApproval -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $CIC_TRANSFER_AUTHORIZATION_ADDRESS + + +# Deploy one-time token faucet for newly created token +>&2 echo "deploy faucet" +DEV_ETH_SARAFU_FAUCET_ADDRESS=`erc20-single-shot-faucet-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --token-address $DEV_ETH_SARAFU_TOKEN_ADDRESS --editor $DEV_ETH_ACCOUNT_FAUCET_OWNER --set-amount $faucet_amount -w $debug` +echo DEV_ETH_SARAFU_FAUCET_ADDRESS=$DEV_ETH_SARAFU_FAUCET_ADDRESS >> $env_out_file +export DEV_ETH_SARAFU_FAUCET_ADDRESS=$DEV_ETH_SARAFU_FAUCET_ADDRESS + +# Transfer tokens to faucet contract +>&2 echo "transfer tokens to faucet contract" +>&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_SARAFU_FAUCET_ADDRESS ${token_amount:0:-1} + +# Register faucet entry +>&2 echo "register faucet contract in registry" +>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k Faucet -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_SARAFU_FAUCET_ADDRESS + + +>&2 echo "deploy token symbol index contract" +CIC_TOKEN_INDEX_ADDRESS=`eth-token-index-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug` +echo CIC_TOKEN_INDEX_ADDRESS=$CIC_TOKEN_INDEX_ADDRESS >> $env_out_file +export CIC_TOKEN_INDEX_ADDRESS=$CIC_TOKEN_INDEX_ADDRESS +>&2 eth-token-index-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_TOKEN_INDEX_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS + +# Register token registry +>&2 echo "register token index in registry" +>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k TokenRegistry -i $CIC_CHAIN_SPEC -w -p $ETH_PROVIDER $CIC_TOKEN_INDEX_ADDRESS + +>&2 echo "add declarations for sarafu token" +token_description_one=`sha256sum sarafu_declaration.json | awk '{ print $1; }'` +token_description_two=0x54686973206973207468652053617261667520746f6b656e0000000000000000 +>&2 eth-address-declarator-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_DECLARATOR_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS $token_description_one +>&2 eth-address-declarator-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_DECLARATOR_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS $token_description_two + + +# Register address declarator +>&2 echo "registry address declarator to registry" +>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k AddressDeclarator -i $CIC_CHAIN_SPEC -w -p $ETH_PROVIDER $CIC_DECLARATOR_ADDRESS + +# We're done with the registry at this point, seal it off +>&2 echo "seal registry contract" +>&2 cic-registry-seal -y $keystore_file -i $CIC_CHAIN_SPEC -r $CIC_REGISTRY_ADDRESS -w -p $ETH_PROVIDER + + +# Add accounts index writer with key from keystore +>&2 echo "add keystore account $keystore_file to accounts index writers" +>&2 eth-accounts-index-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_ACCOUNTS_INDEX_ADDRESS --writer $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER -w $debug + +echo -n 2 > $init_level_file + +set +a +set +e diff --git a/docker-compose.yml b/docker-compose.yml index 89836d25..3751f530 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,8 +35,8 @@ services: context: apps/bloxbergValidatorSetup restart: unless-stopped ports: - - ${HTTP_PORT_ETH:-8545} - - 8546 + - ${DEV_ETH_PORT_HTTP:-8545}:8545 + - ${DEV_ETH_PORT_WS-8546}:8546 - 30303 volumes: #- ./keys:/root/keys # stores the signing key locally @@ -49,7 +49,7 @@ services: POSTGRES_HOST_AUTH_METHOD: trust # for postgres user access w/o password. Obvioulsy not safe but allows easy elevated debugging. # PGDATA: /tmp/cic/postgres ports: - - 5432 + - ${DEV_POSTGRES_PORT:-5432}:5432 volumes: - ./scripts/initdb/create_db.sql:/docker-entrypoint-initdb.d/1-create_all_db.sql - ./apps/cic-meta/scripts/initdb/postgresql.sh:/docker-entrypoint-initdb.d/2-init-cic-meta.sh @@ -58,7 +58,7 @@ services: redis: image: redis:6.0.9-alpine ports: - - ${HTTP_PORT_REDIS:-6379} + - ${DEV_REDIS_PORT:-6379}:6379 command: "--loglevel verbose" bee: @@ -68,8 +68,8 @@ services: BEE_NETWORK_ID: ${BEE_NETWORK_ID:-313} BEE_PASSWORD: ${BEE_PASSWORD:-password} ports: - - 1633 - - 1635 + - ${DEV_BEE_PORT:-1633}:1633 + - ${DEV_BEE_PORT_DEBUG:-1635}:1635 command: "start --swap-enable=false --standalone" volumes: - bee-data:/tmp/cic/bee @@ -85,12 +85,44 @@ services: ETH_PROVIDER_HOST: eth ETH_PROVIDER_PORT: 8545 CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996} + CIC_DATA_DIR: ${CIC_DATA_DIR:-/tmp/cic/config} command: ["./reset.sh"] depends_on: - eth volumes: - contract-config:/tmp/cic/config + seed-cic-eth: + build: + context: apps/ + dockerfile: contract-migration/docker/Dockerfile + environment: + # ETH_PROVIDER should be broken out into host/port but cic-eth expects this + ETH_PROVIDER: http://eth:8545 + # And these two are for wait-for-it (could parse this) + ETH_PROVIDER_HOST: eth + ETH_PROVIDER_PORT: 8545 + CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996} + CIC_DATA_DIR: ${CIC_DATA_DIR:-/tmp/cic/config} + DATABASE_HOST: ${DATABASE_HOST:-postgres} + DATABASE_PORT: ${DATABASE_PORT:-5432} + DATABASE_NAME: ${DEV_DATABASE_NAME_CIC_ETH:-cic_eth} + DATABASE_ENGINE: ${DATABASE_ENGINE:-postgresql} + DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2} + DATABASE_USER: ${DATABASE_USER:-postgres} + REDIS_HOST: ${REDIS_HOST:-redis} + REDIS_PORT: ${REDIS_PORT:-6379} + REDIS_DB: ${REDIS_DB:-0} + 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} + command: ["./seed_cic_eth.sh"] + depends_on: + - eth + volumes: + - contract-config:/tmp/cic/config + + # cic-cache-tracker: # # image: registry.gitlab.com/grassrootseconomics/cic-cache:master-latest # build: apps/cic-cache @@ -155,7 +187,7 @@ services: DATABASE_USER: ${DATABASE_USER:-grassroots} DATABASE_HOST: ${DATABASE_HOST:-postgres} DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala} - DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache} + DATABASE_NAME: ${DATABASE_NAME_CIC_ETH:-cic_eth} DATABASE_PORT: ${DATABASE_PORT:-5432} DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres} DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}