Initial commit

This commit is contained in:
lash 2023-02-11 19:27:54 +00:00
commit ca6a666731
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 69 additions and 0 deletions

62
boot.sh Normal file
View File

@ -0,0 +1,62 @@
export RPC_PROVIDER=${RPC_PROVIDER:-http://localhost:8545}
export CHAIN_SPEC=${CHAIN_SPEC:-evm:celo:1337:celo}
export KEY_FILE=${KEY_FILE:-keyfile.json}
export RPC_DIALECT=${RPC_DIALECT:-chainlib_eth_celo}
export WRITER_KEY_FILE=${WRITER_KEY_FILE:-$KEY_FILE}
export TOKEN_NAME="Testtoken"
export TOKEN_SYMBOL=TST
export TOKEN_DECIMALS=6
# 5000 ppm = 0.005%
#export TOKEN_DEMURRAGE=5000
export TOKEN_DEMURRAGE=20000
# 10080 minutes = 1 week
export TOKEN_PERIOD=43200
export TOKEN_SINK_ADDRESS=${TOKEN_SINK_ADDRESS:-Eb3907eCad74a0013c259D5874AE7f22DcBcC95C}
export GAS_FAUCET_AMOUNT=${GAS_FAUCET_AMOUNT:-20000000}
log='-v'
set +e
t=$(mktemp -d)
# get the writer keyfile address
writer=$(eth-keyfile -d $WRITER_KEY_FILE)
# publish a voucher token
token=$(erc20-demurrage-token-publish --name $TOKEN_NAME --symbol $TOKEN_SYMBOL --decimals $TOKEN_DECIMALS --demurrage-level $TOKEN_DEMURRAGE --redistribution-period $TOKEN_PERIOD --sink-address $TOKEN_SINK_ADDRESS -y $KEY_FILE --fee-limit 5000000 -s -w $log | tee $t/token.txt)
# account registry
accounts=$(eth-accounts-index-publish -y $KEY_FILE --fee-limit 2000000 -s -w $log | tee $t/accounts.txt)
# token index
index=$(eth-token-index-publish -y $KEY_FILE --fee-limit 2000000 -s -w $log | tee $t/index.txt)
# eth faucet
gasfaucet=$(eth-faucet-publish -y $KEY_FILE --fee-limit 2000000 -s -w $log | tee $t/gasfaucet.txt)
# create the faucet period checker
hsh=$(eth-gas -y $KEY_FILE --data <(eth-faucet-gen period) --fee-limit 2000000 -s -w $log 0)
period=$(eth-get $hsh --raw -o contract | tee $t/period.txt)
eth-encode -y $KEY_FILE --mode tx --signature setPoker a:$gasfaucet -e $(eth-checksum $period) --fee-limit 100000 -s -w $log
# set parameters for faucet and period checker backend
eth-encode -y $KEY_FILE --mode tx --signature setAmount u:$GAS_FAUCET_AMOUNT -e $(eth-checksum $gasfaucet) --fee-limit 100000 -s -w $log
eth-encode -y $KEY_FILE --mode tx --signature setRegistry a:$accounts -e $(eth-checksum $gasfaucet) --fee-limit 100000 -s -w $log
eth-encode -y $KEY_FILE --mode tx --signature setPeriodChecker a:$period -e $(eth-checksum $gasfaucet) --fee-limit 100000 -s -w $log
eth-encode -y $KEY_FILE --mode tx --signature setPoker a:$gasfaucet -e $(eth-checksum $period) --fee-limit 100000 -s -w $log
if [ ! -z "$GAS_FAUCET_THRESHOLD" ]; then
eth-encode -y $KEY_FILE --mode tx --signature setBalanceThreshold u:$GAS_FAUCET_THRESHOLD -e $(eth-checksum $period) --fee-limit 100000 -s -w $log
fi
if [ ! -z "$GAS_FAUCET_PERIOD" ]; then
eth-encode -y $KEY_FILE --mode tx --signature setPeriod u:$GAS_FAUCET_PERIOD -e $(eth-checksum $period) --fee-limit 100000 -s -w $log
fi
eth-encode -y $KEY_FILE --mode tx --signature addWriter a:$writer -e $(eth-checksum $accounts) --fee-limit 100000 -s -w $log
eth-encode -y $KEY_FILE --mode tx --signature addWriter a:$writer -e $(eth-checksum $token) --fee-limit 100000 -s -w $log
eth-encode -y $KEY_FILE --mode tx --signature addWriter a:$writer -e $(eth-checksum $index) --fee-limit 100000 -s -w $log
set -e

1
keyfile.json Normal file
View File

@ -0,0 +1 @@
{"address":"eb3907ecad74a0013c259d5874ae7f22dcbcc95c","crypto":{"cipher":"aes-128-ctr","ciphertext":"b0f70a8af4071faff2267374e2423cbc7a71012096fd2215866d8de7445cc215","cipherparams":{"iv":"9ac89383a7793226446dcb7e1b45cdf3"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"299f7b5df1d08a0a7b7f9c9eb44fe4798683b78da3513fcf9603fd913ab3336f"},"mac":"6f4ed36c11345a9a48353cd2f93f1f92958c96df15f3112a192bc994250e8d03"},"id":"61a9dd88-24a9-495c-9a51-152bd1bfaa5b","version":3}

6
requirements.txt Normal file
View File

@ -0,0 +1,6 @@
eth-accounts-index==0.3.3
eth-faucet==0.1.0
eth-token-index==0.4.0
eth-address-index==0.6.0
erc20-transfer-authorization==0.4.1
erc20-demurrage-token==0.3.2