2021-10-20 17:02:36 +02:00
#!/bin/bash
. util.sh
set -a
. ${ DEV_DATA_DIR } /env_reset
WAIT_FOR_TIMEOUT = ${ WAIT_FOR_TIMEOUT :- 60 }
set -e
must_address " $DEV_ADDRESS_DECLARATOR " "address declarator"
must_eth_rpc
2021-10-29 11:36:14 +02:00
if [ ! -z $DEV_FEE_PRICE ] ; then
gas_price_arg = " --gas-price $DEV_FEE_PRICE "
fee_price_arg = " --fee-price $DEV_FEE_PRICE "
2021-10-20 17:02:36 +02:00
fi
# Deploy contract registry contract
2021-10-29 11:36:14 +02:00
advance_nonce
debug_rpc
2021-10-20 17:02:36 +02:00
>& 2 echo -e "\033[;96mDeploy contract registry contract\033[;39m"
2021-10-29 11:36:14 +02:00
CIC_REGISTRY_ADDRESS = ` okota-contract-registry-deploy --nonce $nonce $fee_price_arg -i $CHAIN_SPEC -y $WALLET_KEY_FILE --identifier AccountRegistry --identifier TokenRegistry --identifier AddressDeclarator --identifier Faucet --identifier TransferAuthorization --identifier ContractRegistry --identifier DefaultToken --address-declarator $DEV_ADDRESS_DECLARATOR -p $RPC_PROVIDER $DEV_DEBUG_FLAG -s -u -w`
2021-10-20 17:02:36 +02:00
>& 2 echo -e "\033[;96mAdd contract registry record to itself\033[;39m"
2021-10-29 11:36:14 +02:00
advance_nonce
debug_rpc
r = ` eth-contract-registry-set $DEV_WAIT_FLAG $fee_price_arg --nonce $nonce -s -u -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CHAIN_SPEC -p $RPC_PROVIDER $DEV_DEBUG_FLAG --identifier ContractRegistry $CIC_REGISTRY_ADDRESS `
2021-10-20 17:02:36 +02:00
add_pending_tx_hash $r
>& 2 echo -e "\033[;96mAdd address declarator record to contract registry\033[;39m"
2021-10-29 11:36:14 +02:00
advance_nonce
debug_rpc
r = ` eth-contract-registry-set $DEV_WAIT_FLAG $fee_price_arg --nonce $nonce -s -u -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CHAIN_SPEC -p $RPC_PROVIDER $DEV_DEBUG_FLAG --identifier AddressDeclarator $DEV_ADDRESS_DECLARATOR `
2021-10-20 17:02:36 +02:00
add_pending_tx_hash $r
# Deploy transfer authorization contact
2022-01-04 17:01:01 +01:00
#advance_nonce
#debug_rpc
#>&2 echo -e "\033[;96mDeploy transfer authorization contract\033[;39m"
#DEV_TRANSFER_AUTHORIZATION_ADDRESS=`erc20-transfer-auth-deploy --nonce $nonce -w $gas_price_arg -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER $DEV_DEBUG_FLAG`
#
#
#>&2 echo -e "\033[;96mAdd transfer authorization record to contract registry\033[;39m"
#advance_nonce
#debug_rpc
#r=`eth-contract-registry-set $DEV_WAIT_FLAG $fee_price_arg --nonce $nonce -s -u -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CHAIN_SPEC -p $RPC_PROVIDER $DEV_DEBUG_FLAG --identifier TransferAuthorization $DEV_TRANSFER_AUTHORIZATION_ADDRESS`
#add_pending_tx_hash $r
2021-10-20 17:02:36 +02:00
# Deploy token index contract
2021-10-29 11:36:14 +02:00
advance_nonce
debug_rpc
2021-10-20 17:02:36 +02:00
>& 2 echo -e "\033[;96mDeploy token symbol index contract\033[;39m"
2021-10-29 11:36:14 +02:00
DEV_TOKEN_INDEX_ADDRESS = ` okota-token-index-deploy --nonce $nonce -s -w -u $fee_price_arg -y $WALLET_KEY_FILE -i $CHAIN_SPEC -p $RPC_PROVIDER $DEV_DEBUG_FLAG --address-declarator $DEV_ADDRESS_DECLARATOR `
2021-10-20 17:02:36 +02:00
>& 2 echo -e "\033[;96mAdd token symbol index record to contract registry\033[;39m"
2021-10-29 11:36:14 +02:00
advance_nonce
debug_rpc
r = ` eth-contract-registry-set $DEV_WAIT_FLAG $fee_price_arg --nonce $nonce -s -u -y $WALLET_KEY_FILE -e $CIC_REGISTRY_ADDRESS -i $CHAIN_SPEC -p $RPC_PROVIDER $DEV_DEBUG_FLAG --identifier TokenRegistry $DEV_TOKEN_INDEX_ADDRESS `
2021-10-20 17:02:36 +02:00
add_pending_tx_hash $r
2022-01-04 17:01:01 +01:00
# Assign writer for token index
>& 2 echo -e " \033[;96mEnable token index writer $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER to write to accounts index contract at $DEV_TOKEN_INDEX_ADDRESS \033[;39m "
advance_nonce
debug_rpc
r = ` eth-accounts-index-writer -s -u -i $CHAIN_SPEC -p $RPC_PROVIDER --nonce $nonce --fee-limit 1000000 -e $DEV_TOKEN_INDEX_ADDRESS $DEV_DEBUG_FLAG $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER `
add_pending_tx_hash $r
2021-10-29 11:36:14 +02:00
check_wait 2
2021-10-20 17:02:36 +02:00
echo -e "\033[;96mWriting env_reset file\033[;39m"
confini-dump --schema-dir ./config > ${ DEV_DATA_DIR } /env_reset
set +a
set +e