Compare commits
10 Commits
bvander/ci
...
lash/schmi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
412ab5a186
|
||
|
|
bf80443c8d
|
||
|
|
9c9f41ed4c | ||
|
|
74e57b89ec | ||
| 1360f4d5f4 | |||
| 6c2975b93f | |||
| 81e9128446 | |||
|
|
38781f1a4c
|
||
| d636181479 | |||
| 8edb8c6dba |
@@ -16,8 +16,10 @@ interface = "all"
|
|||||||
[websockets]
|
[websockets]
|
||||||
disable = false
|
disable = false
|
||||||
port = 8546
|
port = 8546
|
||||||
|
#apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
|
||||||
|
apis = ["all"]
|
||||||
interface = "all"
|
interface = "all"
|
||||||
origins = ["none"]
|
origins = ["*"]
|
||||||
|
|
||||||
[account]
|
[account]
|
||||||
password = ["/root/validator.pwd"]
|
password = ["/root/validator.pwd"]
|
||||||
|
|||||||
@@ -3,20 +3,19 @@
|
|||||||
APP_NAME: cic-eth
|
APP_NAME: cic-eth
|
||||||
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
||||||
|
|
||||||
.this_changes_target:
|
.cic_eth_changes_target:
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
- $CONTEXT/$APP_NAME/*
|
- $CONTEXT/$APP_NAME/*
|
||||||
|
|
||||||
build-mr-cic-eth:
|
build-mr-cic-eth:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
- .cic_eth_changes_target
|
||||||
- .py_build_merge_request
|
- .py_build_merge_request
|
||||||
- .cic_eth_variables
|
- .cic_eth_variables
|
||||||
|
|
||||||
build-push-cic-eth:
|
build-push-cic-eth:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
|
||||||
- .py_build_push
|
- .py_build_push
|
||||||
- .cic_eth_variables
|
- .cic_eth_variables
|
||||||
|
|
||||||
|
|||||||
1
apps/cic-eth/README.md
Normal file
1
apps/cic-eth/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# CIC-ETH
|
||||||
@@ -51,27 +51,34 @@ args_override = {
|
|||||||
config.dict_override(args_override, 'cli')
|
config.dict_override(args_override, 'cli')
|
||||||
celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL'))
|
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(
|
def main():
|
||||||
config.get('CIC_CHAIN_SPEC'),
|
redis_host = config.get('REDIS_HOST')
|
||||||
queue=args.q,
|
redis_port = config.get('REDIS_PORT')
|
||||||
callback_param='{}:{}:{}:{}'.format(args.redis_host_callback, args.redis_port_callback, redis_db, redis_channel),
|
redis_db = config.get('REDIS_DB')
|
||||||
callback_task='cic_eth.callbacks.redis.redis',
|
redis_channel = str(uuid.uuid4())
|
||||||
callback_queue=args.q,
|
r = redis.Redis(redis_host, redis_port, redis_db)
|
||||||
)
|
|
||||||
|
|
||||||
register = not args.no_register
|
ps = r.pubsub()
|
||||||
logg.debug('register {}'.format(register))
|
ps.subscribe(redis_channel)
|
||||||
t = api.create_account(register=register)
|
ps.get_message()
|
||||||
|
|
||||||
ps.get_message()
|
api = Api(
|
||||||
m = ps.get_message(timeout=args.timeout)
|
config.get('CIC_CHAIN_SPEC'),
|
||||||
print(json.loads(m['data']))
|
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()
|
||||||
|
|||||||
@@ -211,6 +211,11 @@ def main():
|
|||||||
|
|
||||||
chain_registry = ChainRegistry(chain_spec)
|
chain_registry = ChainRegistry(chain_spec)
|
||||||
CICRegistry.add_chain_registry(chain_registry, True)
|
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:
|
if config.get('ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER') != None:
|
||||||
CICRegistry.add_role(chain_spec, config.get('ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER'), 'AccountRegistry', True)
|
CICRegistry.add_role(chain_spec, config.get('ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER'), 'AccountRegistry', True)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ version = (
|
|||||||
0,
|
0,
|
||||||
10,
|
10,
|
||||||
0,
|
0,
|
||||||
'alpha.24',
|
'alpha.25',
|
||||||
)
|
)
|
||||||
|
|
||||||
version_object = semver.VersionInfo(
|
version_object = semver.VersionInfo(
|
||||||
|
|||||||
@@ -41,3 +41,9 @@ COPY cic-eth/tests/ tests/
|
|||||||
COPY cic-eth/config/ /usr/local/etc/cic-eth/
|
COPY cic-eth/config/ /usr/local/etc/cic-eth/
|
||||||
COPY cic-eth/cic_eth/db/migrations/ /usr/local/share/cic-eth/alembic/
|
COPY cic-eth/cic_eth/db/migrations/ /usr/local/share/cic-eth/alembic/
|
||||||
COPY cic-eth/crypto_dev_signer_config/ /usr/local/etc/crypto-dev-signer/
|
COPY cic-eth/crypto_dev_signer_config/ /usr/local/etc/crypto-dev-signer/
|
||||||
|
|
||||||
|
RUN apt-get install -y git && \
|
||||||
|
git clone https://gitlab.com/grassrootseconomics/cic-contracts.git &&\
|
||||||
|
mkdir -p /usr/local/share/cic/solidity/abi && \
|
||||||
|
cp cic-contracts/abis/* /usr/local/share/cic/solidity/abi/
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/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
|
migrate.py -c /usr/local/etc/cic-eth --migrations-dir /usr/local/share/cic-eth/alembic -vv
|
||||||
|
set +e
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
. ./db.sh
|
. ./db.sh
|
||||||
|
|
||||||
# set CONFINI_ENV_PREFIX to override the env prefix to override env vars
|
# set CONFINI_ENV_PREFIX to override the env prefix to override env vars
|
||||||
@@ -27,3 +28,4 @@ while true; do
|
|||||||
sleep 15;
|
sleep 15;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
set +e
|
||||||
|
|||||||
@@ -4,20 +4,19 @@
|
|||||||
APP_NAME: cic-meta
|
APP_NAME: cic-meta
|
||||||
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
||||||
|
|
||||||
.this_changes_target:
|
.cic_meta_changes_target:
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
- $CONTEXT/$APP_NAME/*
|
- $CONTEXT/$APP_NAME/*
|
||||||
|
|
||||||
build-mr-cic-meta:
|
build-mr-cic-meta:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
- .cic_meta_changes_target
|
||||||
- .py_build_merge_request
|
- .py_build_merge_request
|
||||||
- .cic_meta_variables
|
- .cic_meta_variables
|
||||||
|
|
||||||
build-push-cic-meta:
|
build-push-cic-meta:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
|
||||||
- .py_build_push
|
- .py_build_push
|
||||||
- .cic_meta_variables
|
- .cic_meta_variables
|
||||||
|
|
||||||
|
|||||||
@@ -3,20 +3,19 @@
|
|||||||
APP_NAME: cic-notify
|
APP_NAME: cic-notify
|
||||||
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
||||||
|
|
||||||
.this_changes_target:
|
.cic_notify_changes_target:
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
- $CONTEXT/$APP_NAME/*
|
- $CONTEXT/$APP_NAME/*
|
||||||
|
|
||||||
build-mr-cic-notify:
|
build-mr-cic-notify:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
- .cic_notify_changes_target
|
||||||
- .py_build_merge_request
|
- .py_build_merge_request
|
||||||
- .cic_notify_variables
|
- .cic_notify_variables
|
||||||
|
|
||||||
build-push-cic-notify:
|
build-push-cic-notify:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
|
||||||
- .py_build_push
|
- .py_build_push
|
||||||
- .cic_notify_variables
|
- .cic_notify_variables
|
||||||
|
|
||||||
|
|||||||
@@ -3,20 +3,19 @@
|
|||||||
APP_NAME: cic-ussd
|
APP_NAME: cic-ussd
|
||||||
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
||||||
|
|
||||||
.this_changes_target:
|
.cic_ussd_changes_target:
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
- $CONTEXT/$APP_NAME/*
|
- $CONTEXT/$APP_NAME/*
|
||||||
|
|
||||||
build-mr-cic-ussd:
|
build-mr-cic-ussd:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
- .cic_ussd_changes_target
|
||||||
- .py_build_merge_request
|
- .py_build_merge_request
|
||||||
- .cic_ussd_variables
|
- .cic_ussd_variables
|
||||||
|
|
||||||
build-push-cic-ussd:
|
build-push-cic-ussd:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
|
||||||
- .py_build_push
|
- .py_build_push
|
||||||
- .cic_ussd_variables
|
- .cic_ussd_variables
|
||||||
|
|
||||||
|
|||||||
@@ -3,19 +3,18 @@
|
|||||||
APP_NAME: contract-migration
|
APP_NAME: contract-migration
|
||||||
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
||||||
|
|
||||||
.this_changes_target:
|
.contract_migration_changes_target:
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
- $CONTEXT/$APP_NAME/*
|
- $CONTEXT/$APP_NAME/*
|
||||||
|
|
||||||
build-mr-contract-migration:
|
build-mr-contract-migration:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
- .contract_migration_changes_target
|
||||||
- .py_build_merge_request
|
- .py_build_merge_request
|
||||||
- .contract_migration_variables
|
- .contract_migration_variables
|
||||||
|
|
||||||
build-push-contract-migration:
|
build-push-contract-migration:
|
||||||
extends:
|
extends:
|
||||||
- .this_changes_target
|
|
||||||
- .py_build_push
|
- .py_build_push
|
||||||
- .contract_migration_variables
|
- .contract_migration_variables
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ RUN apk update && \
|
|||||||
|
|
||||||
WORKDIR /usr/src
|
WORKDIR /usr/src
|
||||||
|
|
||||||
ARG cic_config_commit=6c5bda473d3806844696d5716845d51416ed1b47
|
ARG cic_config_commit=35c69ba75f00c8147150acf325565d5391cf25bf
|
||||||
ARG cic_config_url=https://gitlab.com/grassrootseconomics/cic-config.git/
|
ARG cic_config_url=https://gitlab.com/grassrootseconomics/cic-config.git/
|
||||||
RUN echo Install confini schema files && \
|
RUN echo Install confini schema files && \
|
||||||
git clone --depth 1 $cic_config_url cic-config && \
|
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 .
|
pip install --extra-index-url $pip_extra_index_url .
|
||||||
|
|
||||||
RUN echo installing common python tooling
|
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/
|
ARG cic_python_url=https://gitlab.com/grassrootseconomics/cic-python.git/
|
||||||
RUN echo Install sum of python dependencies across all components && \
|
RUN echo Install sum of python dependencies across all components && \
|
||||||
git clone --depth 1 $cic_python_url cic-python && \
|
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
|
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
|
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 pip install --extra-index-url $pip_extra_index_url eth-address-index==$eth_address_index_version
|
||||||
|
|
||||||
RUN echo Install cic specific python packages
|
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 pip install --extra-index-url $pip_extra_index_url cic-registry==$cic_registry_version
|
||||||
|
|
||||||
RUN echo Install misc helpers
|
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/.env_dockercompose_template .env_dockercompose_template
|
||||||
|
|
||||||
COPY contract-migration/reset.sh reset.sh
|
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
|
COPY contract-migration/keystore keystore
|
||||||
|
|
||||||
LABEL version="4"
|
LABEL version="4"
|
||||||
|
|||||||
9
apps/contract-migration/from_env.sh
Normal file
9
apps/contract-migration/from_env.sh
Normal file
@@ -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
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/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)
|
keystore_file=$(realpath ./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c)
|
||||||
|
|
||||||
echo "environment:"
|
echo "environment:"
|
||||||
@@ -12,7 +18,8 @@ echo \n
|
|||||||
# define these parameters at runtime
|
# define these parameters at runtime
|
||||||
# pushd /usr/src
|
# 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).
|
# Abort on any error (including if wait-for-it fails).
|
||||||
set -e
|
set -e
|
||||||
@@ -22,8 +29,7 @@ if [[ -n "${ETH_PROVIDER}" ]]; then
|
|||||||
echo "waiting for ${ETH_PROVIDER}..."
|
echo "waiting for ${ETH_PROVIDER}..."
|
||||||
./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}"
|
./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 --account $DEV_ETH_ACCOUNT_RESERVE_MINTER --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 --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`
|
#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 -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 -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
|
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
|
else
|
||||||
echo "\$ETH_PROVIDER not set!"
|
echo "\$ETH_PROVIDER not set!"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -44,12 +56,18 @@ mkdir -p $CIC_DATA_DIR
|
|||||||
cat << EOF > $CIC_DATA_DIR/.env
|
cat << EOF > $CIC_DATA_DIR/.env
|
||||||
export DEV_ETH_RESERVE_ADDRESS=$DEV_ETH_RESERVE_ADDRESS
|
export DEV_ETH_RESERVE_ADDRESS=$DEV_ETH_RESERVE_ADDRESS
|
||||||
export DEV_ETH_RESERVE_AMOUNT=$DEV_ETH_RESERVE_AMOUNT
|
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 BANCOR_REGISTRY_ADDRESS=$BANCOR_REGISTRY_ADDRESS
|
||||||
export CIC_REGISTRY_ADDRESS=$CIC_REGISTRY_ADDRESS
|
export CIC_REGISTRY_ADDRESS=$CIC_REGISTRY_ADDRESS
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
cat $CIC_DATA_DIR/envlist | bash from_env.sh > $CIC_DATA_DIR/.env_all
|
||||||
# popd
|
# popd
|
||||||
|
|
||||||
|
set +a
|
||||||
|
set +e
|
||||||
|
|
||||||
|
echo -n 1 > $init_level_file
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
18
apps/contract-migration/sarafu_declaration.json
Normal file
18
apps/contract-migration/sarafu_declaration.json
Normal file
File diff suppressed because one or more lines are too long
220
apps/contract-migration/scripts/generate_users.py
Normal file
220
apps/contract-migration/scripts/generate_users.py
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
#!python3
|
||||||
|
|
||||||
|
# standard imports
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
|
import random
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import base64
|
||||||
|
import hashlib
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import vobject
|
||||||
|
|
||||||
|
import celery
|
||||||
|
import web3
|
||||||
|
from faker import Faker
|
||||||
|
import cic_registry
|
||||||
|
import confini
|
||||||
|
from cic_eth.api import Api
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
fake = Faker(['sl', 'en_US', 'no', 'de', 'ro'])
|
||||||
|
|
||||||
|
config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic')
|
||||||
|
|
||||||
|
argparser = argparse.ArgumentParser()
|
||||||
|
argparser.add_argument('-c', type=str, default=config_dir, help='config file')
|
||||||
|
argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec')
|
||||||
|
argparser.add_argument('-z', '--zero-balance', dest='z', action='store_true', help='do not generate initial balances')
|
||||||
|
argparser.add_argument('source', type=str, help='input directory to process')
|
||||||
|
args = argparser.parse_args()
|
||||||
|
|
||||||
|
config = confini.Config(config_dir, os.environ.get('CONFINI_ENV_PREFIX'))
|
||||||
|
config.process()
|
||||||
|
args_override = {
|
||||||
|
'CIC_CHAIN_SPEC': getattr(args, 'i'),
|
||||||
|
'ETH_PROVIDER': getattr(args, 'p'),
|
||||||
|
}
|
||||||
|
config.dict_override(args_override, 'cli flag')
|
||||||
|
logg.info('loaded config\n{}'.format(config))
|
||||||
|
|
||||||
|
|
||||||
|
# registration time generation
|
||||||
|
dt_now = datetime.datetime.utcnow()
|
||||||
|
dt_then = dt_now - datetime.timedelta(weeks=150)
|
||||||
|
ts_now = int(dt_now.timestamp())
|
||||||
|
ts_then = int(dt_then.timestamp())
|
||||||
|
|
||||||
|
celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL'))
|
||||||
|
|
||||||
|
api = Api(config.get('CIC_CHAIN_SPEC'))
|
||||||
|
|
||||||
|
gift_activate = not args.z
|
||||||
|
gift_max = 10000
|
||||||
|
gift_factor = (10**9)
|
||||||
|
|
||||||
|
|
||||||
|
categories = [
|
||||||
|
"food/water",
|
||||||
|
"fuel/energy",
|
||||||
|
"education",
|
||||||
|
"health",
|
||||||
|
"shop",
|
||||||
|
"environment",
|
||||||
|
"transport",
|
||||||
|
"farming/labor",
|
||||||
|
"savingsgroup",
|
||||||
|
]
|
||||||
|
|
||||||
|
phone_idx = []
|
||||||
|
|
||||||
|
|
||||||
|
def genPhoneIndex(phone):
|
||||||
|
h = hashlib.new('sha256')
|
||||||
|
h.update(phone.encode('utf-8'))
|
||||||
|
h.update(b'cic.msisdn')
|
||||||
|
return h.digest().hex()
|
||||||
|
|
||||||
|
|
||||||
|
def genId(addr, typ):
|
||||||
|
h = hashlib.new('sha256')
|
||||||
|
h.update(bytes.fromhex(addr[2:]))
|
||||||
|
h.update(typ.encode('utf-8'))
|
||||||
|
return h.digest().hex()
|
||||||
|
|
||||||
|
|
||||||
|
def genDate():
|
||||||
|
|
||||||
|
logg.info(ts_then)
|
||||||
|
ts = random.randint(ts_then, ts_now)
|
||||||
|
return datetime.datetime.fromtimestamp(ts).timestamp()
|
||||||
|
|
||||||
|
|
||||||
|
def genPhone():
|
||||||
|
return fake.msisdn()
|
||||||
|
|
||||||
|
|
||||||
|
def genPersonal(phone):
|
||||||
|
fn = fake.first_name()
|
||||||
|
ln = fake.last_name()
|
||||||
|
e = fake.email()
|
||||||
|
|
||||||
|
v = vobject.vCard()
|
||||||
|
first_name = fake.first_name()
|
||||||
|
last_name = fake.last_name()
|
||||||
|
v.add('n')
|
||||||
|
v.n.value = vobject.vcard.Name(family=last_name, given=first_name)
|
||||||
|
v.add('fn')
|
||||||
|
v.fn.value = '{} {}'.format(first_name, last_name)
|
||||||
|
v.add('tel')
|
||||||
|
v.tel.typ_param = 'CELL'
|
||||||
|
v.tel.value = phone
|
||||||
|
v.add('email')
|
||||||
|
v.email.value = fake.email()
|
||||||
|
|
||||||
|
vcard_serialized = v.serialize()
|
||||||
|
vcard_base64 = base64.b64encode(vcard_serialized.encode('utf-8'))
|
||||||
|
|
||||||
|
return vcard_base64.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
def genCats():
|
||||||
|
i = random.randint(0, 3)
|
||||||
|
return random.choices(categories, k=i)
|
||||||
|
|
||||||
|
|
||||||
|
def genAmount():
|
||||||
|
return random.randint(0, gift_max) * gift_factor
|
||||||
|
|
||||||
|
|
||||||
|
def gen():
|
||||||
|
old_blockchain_address = '0x' + os.urandom(20).hex()
|
||||||
|
accounts_index_account = config.get('DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER')
|
||||||
|
if not accounts_index_account:
|
||||||
|
accounts_index_account = None
|
||||||
|
logg.debug('accounts indexwriter {}'.format(accounts_index_account))
|
||||||
|
t = api.create_account()
|
||||||
|
new_blockchain_address = t.get()
|
||||||
|
gender = random.choice(['female', 'male', 'other'])
|
||||||
|
phone = genPhone()
|
||||||
|
v = genPersonal(phone)
|
||||||
|
o = {
|
||||||
|
'date_registered': genDate(),
|
||||||
|
'vcard': v,
|
||||||
|
'gender': gender,
|
||||||
|
'key': {
|
||||||
|
'ethereum': [
|
||||||
|
old_blockchain_address,
|
||||||
|
new_blockchain_address,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'location': {
|
||||||
|
'latitude': str(fake.latitude()),
|
||||||
|
'longitude': str(fake.longitude()),
|
||||||
|
'external': { # add osm lookup
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'selling': genCats(),
|
||||||
|
}
|
||||||
|
uid = genId(new_blockchain_address, 'cic.person')
|
||||||
|
|
||||||
|
#logg.info('gifting {} to {}'.format(amount, new_blockchain_address))
|
||||||
|
|
||||||
|
return (uid, phone, o)
|
||||||
|
|
||||||
|
|
||||||
|
def prepareLocalFilePath(datadir, address):
|
||||||
|
parts = [
|
||||||
|
address[:2],
|
||||||
|
address[2:4],
|
||||||
|
]
|
||||||
|
dirs = '{}/{}/{}'.format(
|
||||||
|
datadir,
|
||||||
|
parts[0],
|
||||||
|
parts[1],
|
||||||
|
)
|
||||||
|
os.makedirs(dirs, exist_ok=True)
|
||||||
|
return dirs
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
os.makedirs('data/person', exist_ok=True)
|
||||||
|
os.makedirs('data/phone', exist_ok=True)
|
||||||
|
|
||||||
|
fa = open('./data/amounts', 'w')
|
||||||
|
fb = open('./data/addresses', 'w')
|
||||||
|
|
||||||
|
for i in range(int(sys.argv[1])):
|
||||||
|
|
||||||
|
(uid, phone, o) = gen()
|
||||||
|
eth = o['key']['ethereum'][1]
|
||||||
|
|
||||||
|
print(o)
|
||||||
|
|
||||||
|
d = prepareLocalFilePath('./data/person', uid)
|
||||||
|
f = open('{}/{}'.format(d, uid), 'w')
|
||||||
|
json.dump(o, f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
pidx = genPhoneIndex(phone)
|
||||||
|
d = prepareLocalFilePath('./data/phone', uid)
|
||||||
|
f = open('{}/{}'.format(d, pidx), 'w')
|
||||||
|
f.write(eth)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
amount = genAmount()
|
||||||
|
fa.write('{},{}\n'.format(eth,amount))
|
||||||
|
fb.write('{}\n'.format(eth))
|
||||||
|
logg.debug('pidx {}, uid {}, eth {}, amount {}'.format(pidx, uid, eth, amount))
|
||||||
|
|
||||||
|
fb.close()
|
||||||
|
fa.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
115
apps/contract-migration/scripts/import_users.py
Normal file
115
apps/contract-migration/scripts/import_users.py
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
# standard imports
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import argparse
|
||||||
|
import uuid
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
|
# third-party imports
|
||||||
|
import redis
|
||||||
|
import confini
|
||||||
|
import celery
|
||||||
|
from chainlib.eth.address import to_checksum
|
||||||
|
from cic_types.models.person import Person
|
||||||
|
from cic_eth.api.api_task import Api
|
||||||
|
from cic_registry.chain import ChainSpec
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.WARNING)
|
||||||
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
default_config_dir = '/usr/local/etc/cic'
|
||||||
|
|
||||||
|
argparser = argparse.ArgumentParser()
|
||||||
|
argparser.add_argument('-c', type=str, default=default_config_dir, help='config file')
|
||||||
|
argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string')
|
||||||
|
argparser.add_argument('--redis-host', dest='redis_host', type=str, help='redis host to use for task submission')
|
||||||
|
argparser.add_argument('--redis-port', dest='redis_port', type=int, help='redis host to use for task submission')
|
||||||
|
argparser.add_argument('--redis-db', dest='redis_db', type=int, help='redis db to use for task submission and callback')
|
||||||
|
argparser.add_argument('--redis-host-callback', dest='redis_host_callback', default='localhost', type=str, help='redis host to use for callback')
|
||||||
|
argparser.add_argument('--redis-port-callback', dest='redis_port_callback', default=6379, type=int, help='redis port to use for callback')
|
||||||
|
argparser.add_argument('--timeout', default=20.0, type=float, help='Callback timeout')
|
||||||
|
argparser.add_argument('-q', type=str, default='cic-eth', help='Task queue')
|
||||||
|
argparser.add_argument('-v', action='store_true', help='Be verbose')
|
||||||
|
argparser.add_argument('-vv', action='store_true', help='Be more verbose')
|
||||||
|
argparser.add_argument('user_dir', type=str, help='path to users export dir tree')
|
||||||
|
args = argparser.parse_args()
|
||||||
|
|
||||||
|
if args.v:
|
||||||
|
logg.setLevel(logging.INFO)
|
||||||
|
elif args.vv:
|
||||||
|
logg.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
config_dir = args.c
|
||||||
|
config = confini.Config(config_dir, os.environ.get('CONFINI_ENV_PREFIX'))
|
||||||
|
config.process()
|
||||||
|
args_override = {
|
||||||
|
'CIC_CHAIN_SPEC': getattr(args, 'i'),
|
||||||
|
'REDIS_HOST': getattr(args, 'redis_host'),
|
||||||
|
'REDIS_PORT': getattr(args, 'redis_port'),
|
||||||
|
'REDIS_DB': getattr(args, 'redis_db'),
|
||||||
|
}
|
||||||
|
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')
|
||||||
|
r = redis.Redis(redis_host, redis_port, redis_db)
|
||||||
|
|
||||||
|
ps = r.pubsub()
|
||||||
|
|
||||||
|
user_dir = args.user_dir
|
||||||
|
|
||||||
|
|
||||||
|
def register_eth(u):
|
||||||
|
redis_channel = str(uuid.uuid4())
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
t = api.create_account(register=True)
|
||||||
|
|
||||||
|
ps.get_message()
|
||||||
|
m = ps.get_message(timeout=args.timeout)
|
||||||
|
address = json.loads(m['data'])
|
||||||
|
logg.debug('register eth {} {}'.format(u, address))
|
||||||
|
|
||||||
|
return address
|
||||||
|
|
||||||
|
|
||||||
|
def register_ussd(u):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
fi = open(os.path.join(user_dir, 'addresses.csv'), 'a') # old,new
|
||||||
|
|
||||||
|
for x in os.walk(user_dir):
|
||||||
|
for y in x[2]:
|
||||||
|
if y[len(y)-5:] != '.json':
|
||||||
|
continue
|
||||||
|
filepath = os.path.join(x[0], y)
|
||||||
|
f = open(filepath, 'r')
|
||||||
|
try:
|
||||||
|
o = json.load(f)
|
||||||
|
except json.decoder.JSONDecodeError as e:
|
||||||
|
f.close()
|
||||||
|
logg.error('load error for {}: {}'.format(y, e))
|
||||||
|
continue
|
||||||
|
f.close()
|
||||||
|
u = Person(o)
|
||||||
|
|
||||||
|
new_address = register_eth(u)
|
||||||
|
|
||||||
|
old_address = u.identities['evm']['bloxberg:8995'][0]
|
||||||
|
fi.write('{}.{}\n'.format(old_address, new_address))
|
||||||
|
|
||||||
|
fi.close()
|
||||||
2
apps/contract-migration/scripts/requirements.txt
Normal file
2
apps/contract-migration/scripts/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cic-types==0.1.0
|
||||||
|
chainlib==0.0.1a4
|
||||||
142
apps/contract-migration/seed_cic_eth.sh
Normal file
142
apps/contract-migration/seed_cic_eth.sh
Normal file
@@ -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
|
||||||
@@ -35,8 +35,8 @@ services:
|
|||||||
context: apps/bloxbergValidatorSetup
|
context: apps/bloxbergValidatorSetup
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- ${HTTP_PORT_ETH:-8545}
|
- ${DEV_ETH_PORT_HTTP:-8545}:8545
|
||||||
- 8546
|
- ${DEV_ETH_PORT_WS-8546}:8546
|
||||||
- 30303
|
- 30303
|
||||||
volumes:
|
volumes:
|
||||||
#- ./keys:/root/keys # stores the signing key locally
|
#- ./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.
|
POSTGRES_HOST_AUTH_METHOD: trust # for postgres user access w/o password. Obvioulsy not safe but allows easy elevated debugging.
|
||||||
# PGDATA: /tmp/cic/postgres
|
# PGDATA: /tmp/cic/postgres
|
||||||
ports:
|
ports:
|
||||||
- 5432
|
- ${DEV_POSTGRES_PORT:-5432}:5432
|
||||||
volumes:
|
volumes:
|
||||||
- ./scripts/initdb/create_db.sql:/docker-entrypoint-initdb.d/1-create_all_db.sql
|
- ./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
|
- ./apps/cic-meta/scripts/initdb/postgresql.sh:/docker-entrypoint-initdb.d/2-init-cic-meta.sh
|
||||||
@@ -58,7 +58,7 @@ services:
|
|||||||
redis:
|
redis:
|
||||||
image: redis:6.0.9-alpine
|
image: redis:6.0.9-alpine
|
||||||
ports:
|
ports:
|
||||||
- ${HTTP_PORT_REDIS:-6379}
|
- ${DEV_REDIS_PORT:-6379}:6379
|
||||||
command: "--loglevel verbose"
|
command: "--loglevel verbose"
|
||||||
|
|
||||||
bee:
|
bee:
|
||||||
@@ -68,8 +68,8 @@ services:
|
|||||||
BEE_NETWORK_ID: ${BEE_NETWORK_ID:-313}
|
BEE_NETWORK_ID: ${BEE_NETWORK_ID:-313}
|
||||||
BEE_PASSWORD: ${BEE_PASSWORD:-password}
|
BEE_PASSWORD: ${BEE_PASSWORD:-password}
|
||||||
ports:
|
ports:
|
||||||
- 1633
|
- ${DEV_BEE_PORT:-1633}:1633
|
||||||
- 1635
|
- ${DEV_BEE_PORT_DEBUG:-1635}:1635
|
||||||
command: "start --swap-enable=false --standalone"
|
command: "start --swap-enable=false --standalone"
|
||||||
volumes:
|
volumes:
|
||||||
- bee-data:/tmp/cic/bee
|
- bee-data:/tmp/cic/bee
|
||||||
@@ -85,12 +85,44 @@ services:
|
|||||||
ETH_PROVIDER_HOST: eth
|
ETH_PROVIDER_HOST: eth
|
||||||
ETH_PROVIDER_PORT: 8545
|
ETH_PROVIDER_PORT: 8545
|
||||||
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
||||||
|
CIC_DATA_DIR: ${CIC_DATA_DIR:-/tmp/cic/config}
|
||||||
command: ["./reset.sh"]
|
command: ["./reset.sh"]
|
||||||
depends_on:
|
depends_on:
|
||||||
- eth
|
- eth
|
||||||
volumes:
|
volumes:
|
||||||
- contract-config:/tmp/cic/config
|
- 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:
|
# cic-cache-tracker:
|
||||||
# # image: registry.gitlab.com/grassrootseconomics/cic-cache:master-latest
|
# # image: registry.gitlab.com/grassrootseconomics/cic-cache:master-latest
|
||||||
# build: apps/cic-cache
|
# build: apps/cic-cache
|
||||||
@@ -155,7 +187,7 @@ services:
|
|||||||
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
||||||
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
||||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
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_PORT: ${DATABASE_PORT:-5432}
|
||||||
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
||||||
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
||||||
|
|||||||
Reference in New Issue
Block a user