Merge branch 'lash/new-sarafu-token' into lash/demurrage-task
This commit is contained in:
commit
51109db487
@ -22,7 +22,7 @@ COPY contract-migration/nvm.sh .
|
||||
ENV CONFINI_DIR /usr/local/etc/cic/
|
||||
RUN mkdir -vp $CONFINI_DIR
|
||||
|
||||
ARG cic_config_commit=35c69ba75f00c8147150acf325565d5391cf25bf
|
||||
ARG cic_config_commit=0abe0867f18077907c7023bf0ef5e466a3984dd8
|
||||
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 && \
|
||||
@ -56,7 +56,9 @@ COPY contract-migration/requirements.txt .
|
||||
ARG pip_extra_args=""
|
||||
ARG pip_index_url=https://pypi.org/simple
|
||||
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
|
||||
RUN pip install --index-url https://pypi.org/simple \
|
||||
ARG pip_trusted_host=pypi.org
|
||||
RUN pip install --index-url $pip_index_url \
|
||||
--trusted-host $pip_trusted_host \
|
||||
--extra-index-url $pip_extra_index_url -r requirements.txt
|
||||
|
||||
# -------------- begin runtime container ----------------
|
||||
@ -97,4 +99,13 @@ RUN chmod gu+x *.sh
|
||||
|
||||
# USER grassroots
|
||||
|
||||
ARG pip_index_url=https://pypi.org/simple
|
||||
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
|
||||
ARG pip_trusted_host=pypi.org
|
||||
COPY contract-migration/override_requirements.txt .
|
||||
RUN pip install --index-url $pip_index_url \
|
||||
--force-reinstall \
|
||||
--trusted-host $pip_trusted_host \
|
||||
--extra-index-url $pip_extra_index_url -r override_requirements.txt
|
||||
|
||||
ENTRYPOINT [ ]
|
||||
|
93
apps/contract-migration/docker/Dockerfile.dev
Normal file
93
apps/contract-migration/docker/Dockerfile.dev
Normal file
@ -0,0 +1,93 @@
|
||||
# syntax = docker/dockerfile:1.2
|
||||
FROM python:3.8.6-slim-buster as compile-image
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends git gcc g++ libpq-dev gawk jq telnet wget openssl iputils-ping gnupg socat bash procps make python2 cargo
|
||||
|
||||
RUN touch /etc/apt/sources.list.d/ethereum.list
|
||||
RUN echo 'deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' > /etc/apt/sources.list.d/ethereum.list
|
||||
RUN echo 'deb-src http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' >> /etc/apt/sources.list.d/ethereum.list
|
||||
|
||||
RUN cat etc/apt/sources.list.d/ethereum.list
|
||||
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2A518C819BE37D2C2031944D1C52189C923F6CA9
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install solc
|
||||
RUN pip install --upgrade pip
|
||||
|
||||
WORKDIR /root
|
||||
RUN mkdir -vp /usr/local/etc/cic
|
||||
|
||||
COPY contract-migration/nvm.sh .
|
||||
ENV CONFINI_DIR /usr/local/etc/cic/
|
||||
RUN mkdir -vp $CONFINI_DIR
|
||||
|
||||
ARG cic_config_commit=0abe0867f18077907c7023bf0ef5e466a3984dd8
|
||||
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 && \
|
||||
cd cic-config && \
|
||||
git fetch --depth 1 origin $cic_config_commit && \
|
||||
git checkout $cic_config_commit && \
|
||||
cp -v *.ini $CONFINI_DIR
|
||||
|
||||
# Install nvm with node and npm
|
||||
# https://stackoverflow.com/questions/25899912/how-to-install-nvm-in-docker
|
||||
ENV NVM_DIR /root/.nvm
|
||||
ENV NODE_VERSION 15.3.0
|
||||
ENV BANCOR_NODE_VERSION 10.16.0
|
||||
|
||||
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash \
|
||||
&& . $NVM_DIR/nvm.sh \
|
||||
&& nvm install $NODE_VERSION \
|
||||
&& nvm alias default $NODE_VERSION \
|
||||
&& nvm use $NODE_VERSION
|
||||
# && chown -R root:root "$NVM_DIR/versions/node/v$NODE_VERSION"
|
||||
|
||||
ENV NODE_PATH $NVM_DIR/versions/node//v$NODE_VERSION/lib/node_modules
|
||||
ENV PATH $NVM_DIR/versions/node//v$NODE_VERSION/bin:$PATH
|
||||
|
||||
#RUN useradd --create-home grassroots
|
||||
# WORKDIR /home/grassroots
|
||||
# USER grassroots
|
||||
|
||||
COPY contract-migration/requirements.txt .
|
||||
|
||||
ARG pip_extra_args=""
|
||||
ARG pip_index_url=https://pypi.org/simple
|
||||
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
|
||||
ARG pip_trusted_host=pypi.org
|
||||
RUN pip install --index-url $pip_index_url \
|
||||
--trusted-host $pip_trusted_host \
|
||||
--extra-index-url $pip_extra_index_url -r requirements.txt
|
||||
|
||||
COPY contract-migration/testdata/pgp testdata/pgp
|
||||
COPY contract-migration/sarafu_declaration.json sarafu_declaration.json
|
||||
COPY contract-migration/keystore keystore
|
||||
COPY contract-migration/envlist .
|
||||
|
||||
# A shared output dir for environment configs
|
||||
RUN mkdir -p /tmp/cic/config
|
||||
# RUN chown grassroots:grassroots /tmp/cic/config
|
||||
RUN chmod a+rwx /tmp/cic/config
|
||||
|
||||
COPY contract-migration/*.sh ./
|
||||
# RUN chown grassroots:grassroots -R .
|
||||
RUN chmod gu+x *.sh
|
||||
|
||||
# we copied these from the root build container.
|
||||
# this is dumb though...I guess the compile image should have the same user
|
||||
# RUN chown grassroots:grassroots -R /usr/local/lib/python3.8/site-packages/
|
||||
|
||||
# USER grassroots
|
||||
|
||||
ARG pip_index_url=https://pypi.org/simple
|
||||
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
|
||||
ARG pip_trusted_host=pypi.org
|
||||
COPY contract-migration/override_requirements.txt .
|
||||
RUN pip install --index-url $pip_index_url \
|
||||
--force-reinstall \
|
||||
--trusted-host $pip_trusted_host \
|
||||
--extra-index-url $pip_extra_index_url -r override_requirements.txt
|
||||
|
||||
ENTRYPOINT [ ]
|
3
apps/contract-migration/override_requirements.txt
Normal file
3
apps/contract-migration/override_requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
#eth-contract-registry==0.5.5a3
|
||||
#erc20-demurrage-token==0.0.1b4
|
||||
#eth-address-index==0.1.1a12
|
@ -1,4 +1,4 @@
|
||||
cic-base[full]==0.1.3a1
|
||||
sarafu-faucet==0.0.4a1
|
||||
erc20-demurrage-token==0.0.2a2
|
||||
cic-eth==0.12.0a1
|
||||
cic_base[full]==0.1.3a3+build.984b5cff
|
||||
sarafu-faucet~=0.0.4a1
|
||||
cic-eth~=0.11.1a2
|
||||
erc20-demurrage-token==0.0.2a1
|
||||
|
@ -2,8 +2,20 @@
|
||||
|
||||
set -a
|
||||
|
||||
CIC_CHAIN_SPEC=${CIC_CHAIN_SPEC:-evm:bloxberg:8995}
|
||||
CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT}
|
||||
TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL}
|
||||
cat <<EOF
|
||||
external token settings:
|
||||
token_symbol: $TOKEN_SYMBOL
|
||||
token_name: $TOKEN_NAME
|
||||
token_decimals: $TOKEN_DECIMALS
|
||||
token_demurrage: $TOKEN_DEMURRAGE_LEVEL
|
||||
token_redistribution_period: $TOKEN_REDISTRIBUTION_PERIOD
|
||||
token_supply_limit: $TOKEN_SUPPLY_LIMIT
|
||||
EOF
|
||||
|
||||
CIC_CHAIN_SPEC=${CIC_CHAIN_SPEC:-evm:bloxberg:8995}
|
||||
TOKEN_SYMBOL=${TOKEN_SYMBOL:-GFT}
|
||||
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_RESERVE_AMOUNT=${DEV_ETH_RESERVE_AMOUNT:-""10000000000000000000000000000000000}
|
||||
@ -19,8 +31,8 @@ if [ ! -z $DEV_ETH_GAS_PRICE ]; then
|
||||
>&2 echo using static gas price $DEV_ETH_GAS_PRICE
|
||||
fi
|
||||
|
||||
if [[ $CIC_DEFAULT_TOKEN_SYMBOL != 'GFT' && $CIC_DEFAULT_TOKEN_SYMBOL != 'SRF' ]]; then
|
||||
>&2 echo CIC_DEFAULT_TOKEN_SYMBOL must be one of [GFT,SRF], but was $CIC_DEFAULT_TOKEN_SYMBOL
|
||||
if [[ $TOKEN_SYMBOL != 'GFT' && $TOKEN_SYMBOL != 'SRF' ]]; then
|
||||
>&2 echo TOKEN_SYMBOL must be one of [GFT,SRF], but was $TOKEN_SYMBOL
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -60,17 +72,18 @@ if [[ -n "${ETH_PROVIDER}" ]]; then
|
||||
./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}"
|
||||
fi
|
||||
|
||||
if [ $CIC_DEFAULT_TOKEN_SYMBOL == 'GFT' ]; then
|
||||
if [ $TOKEN_SYMBOL == 'GFT' ]; then
|
||||
>&2 echo "deploying 'giftable token'"
|
||||
DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Giftable Token" --symbol "GFT" --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 "Giftable Token" --symbol "GFT" --decimals 6 -vv`
|
||||
else
|
||||
>&2 echo "deploying 'sarafu' token'"
|
||||
DEV_RESERVE_ADDRESS=`sarafu-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Sarafu" --decimals 6 -vv SRF $DEV_SARAFU_DEMURRAGE_LEVEL`
|
||||
>&2 echo "deploying 'redistributed demurrage token'"
|
||||
if [ -z $TOKEN_SINK_ADDRESS && ! -z $TOKEN_REDISTRIBUTION_PERIOD ]; then
|
||||
>&2 echo -e "\033[;93mtoken sink address not set, so redistribution will be BURNED\033[;39m"
|
||||
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`
|
||||
fi
|
||||
giftable-token-gift $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT
|
||||
|
||||
#BANCOR_REGISTRY_ADDRESS=`cic-bancor-deploy $gas_price_arg --bancor-dir /usr/local/share/cic/bancor -z $DEV_ETH_RESERVE_ADDRESS -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER`
|
||||
|
||||
>&2 echo "deploy account index contract"
|
||||
DEV_ACCOUNT_INDEX_ADDRESS=`eth-accounts-index-deploy $gas_price_arg -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -vv -w`
|
||||
>&2 echo "add deployer address as account index writer"
|
||||
|
@ -2,13 +2,22 @@
|
||||
|
||||
if [[ $((RUN_MASK & 1)) -eq 1 ]]
|
||||
then
|
||||
>&2 echo -e "\033[;96mRUNNING\033[;39m RUN_MASK 1 - contract deployment"
|
||||
./reset.sh
|
||||
if [ $? -ne "0" ]; then
|
||||
>&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 1 - contract deployment"
|
||||
exit 1;
|
||||
fi
|
||||
>&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 1 - contract deployment"
|
||||
fi
|
||||
|
||||
if [[ $((RUN_MASK & 2)) -eq 2 ]]
|
||||
then
|
||||
>&2 echo -e "\033[;96mRUNNING\033[;39m RUN_MASK 2 - custodial service initialization"
|
||||
./seed_cic_eth.sh
|
||||
if [ $? -ne "0" ]; then
|
||||
>&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 2 - custodial service initialization"
|
||||
exit 1;
|
||||
fi
|
||||
>&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 2 - custodial service initialization"
|
||||
fi
|
||||
|
@ -14,6 +14,7 @@ DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"}
|
||||
CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic}
|
||||
ETH_PASSPHRASE=''
|
||||
CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT}
|
||||
TOKEN_SYMBOL=$CIC_DEFAULT_TOKEN_SYMBOL
|
||||
if [[ $CIC_DEFAULT_TOKEN_SYMBOL != 'GFT' && $CIC_DEFAULT_TOKEN_SYMBOL != 'SRF' ]]; then
|
||||
>&2 echo CIC_DEFAULT_TOKEN_SYMBOL must be one of [GFT,SRF], but was $CIC_DEFAULT_TOKEN_SYMBOL
|
||||
exit 1
|
||||
@ -98,8 +99,8 @@ 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 erc20-transfer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --token-address $DEV_RESERVE_ADDRESS -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${token_amount:0:-1}
|
||||
>&2 echo "transfer tokens to token gifter address"
|
||||
>&2 erc20-transfer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --gas-limit 100000 --token-address $DEV_RESERVE_ADDRESS -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${token_amount:0:-1}
|
||||
|
||||
#echo -n 0 > $init_level_file
|
||||
|
||||
|
@ -9,16 +9,18 @@ fi
|
||||
t=$(mktemp)
|
||||
>&2 echo using tmp $t
|
||||
|
||||
repos=(../../cic-cache ../../cic-eth ../../cic-ussd ../../data-seeding ../../cic-notify)
|
||||
repos=(../../cic-cache ../../cic-eth ../../cic-ussd ../../data-seeding ../../cic-notify ../../contract-migration)
|
||||
|
||||
for r in ${repos[@]}; do
|
||||
f="$r/requirements.txt"
|
||||
>&2 echo updating $f
|
||||
pyreq-update $f base_requirement.txt -vv > $t
|
||||
pyreq-update $f base_requirement.txt -v > $t
|
||||
cp $t $f
|
||||
|
||||
f="$r/test_requirements.txt"
|
||||
if [ -f $f ]; then
|
||||
>&2 echo updating $f
|
||||
pyreq-update $f base_requirement.txt -vv > $t
|
||||
pyreq-update $f base_requirement.txt -v > $t
|
||||
cp $t $f
|
||||
fi
|
||||
done
|
||||
|
@ -72,11 +72,12 @@ services:
|
||||
|
||||
contract-migration:
|
||||
build:
|
||||
dockerfile: contract-migration/docker/Dockerfile.dev
|
||||
#dockerfile: contract-migration/docker/Dockerfile
|
||||
args:
|
||||
pip_index_url: ${PIP_DEFAULT_INDEX_URL:-https://pypi.org/simple}
|
||||
pip_extra_args: $PIP_EXTRA_ARGS
|
||||
context: apps/
|
||||
dockerfile: contract-migration/docker/Dockerfile
|
||||
# image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/contract-migration:latest
|
||||
environment:
|
||||
# ETH_PROVIDER should be broken out into host/port but cic-eth expects this
|
||||
@ -101,9 +102,16 @@ 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}
|
||||
CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-GFT}
|
||||
DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000}
|
||||
#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}
|
||||
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
|
||||
#CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config}
|
||||
command: ["./run_job.sh"]
|
||||
#command: ["./reset.sh"]
|
||||
depends_on:
|
||||
|
Loading…
Reference in New Issue
Block a user