From abac56c4272d9053b8b26fc4d9074804a1a99927 Mon Sep 17 00:00:00 2001 From: Odysseas Lamtzidis Date: Thu, 16 Sep 2021 16:15:14 +0300 Subject: [PATCH 1/2] Add example to dapp verify-contract context: https://github.com/dapphub/dapptools/issues/753 --- src/dapp/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dapp/README.md b/src/dapp/README.md index ac3cdbd70..d1aaac860 100644 --- a/src/dapp/README.md +++ b/src/dapp/README.md @@ -551,6 +551,8 @@ Spins up a geth testnet. dapp-verify-contract -- verify contract source on etherscan Usage: dapp verify-contract :
[constructorArgs] + +Example: `dapp verify-contract src/auth/authorities/RolesAuthority.sol:RolesAuthority 0x9ed0e..` Requires `ETHERSCAN_API_KEY` to be set. From 8d943a289ee7ab3da7535ccc73a504ca87a3e02d Mon Sep 17 00:00:00 2001 From: Odysseas Lamtzidis Date: Mon, 20 Sep 2021 23:40:09 +0300 Subject: [PATCH 2/2] Add gasnow info, make more human-friendly msg --- src/seth/libexec/seth/seth-gas-price | 46 +++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/seth/libexec/seth/seth-gas-price b/src/seth/libexec/seth/seth-gas-price index b5aac8e87..ed11dbf26 100755 --- a/src/seth/libexec/seth/seth-gas-price +++ b/src/seth/libexec/seth/seth-gas-price @@ -1,3 +1,47 @@ #!/usr/bin/env bash set -e -seth rpc eth_gasPrice + +if command -v tput > /dev/null 2>&1; then + if [ $(($(tput colors 2> /dev/null))) -ge 8 ]; then + # Enable colors + TPUT_RESET="$(tput sgr 0)" + TPUT_YELLOW="$(tput setaf 3)" + TPUT_RED="$(tput setaf 1)" + TPUT_BLUE="$(tput setaf 4)" + TPUT_GREEN="$(tput setaf 2)" + TPUT_WHITE="$(tput setaf 7)" + TPUT_BOLD="$(tput bold)" + fi +fi + + +GASNOW_RESPONSE=$(curl -s https://www.gasnow.org/api/v3/gas/price) +response=$(jq '.code' <<< $GASNOW_RESPONSE) + if [[ $response != "200" ]]; then + echo "Could not get gas information from ${TPUT_BOLD}gasnow.org${TPUT_RESET}: https://www.gasnow.org" + echo "response code: $response" + else + rapid=$(( $(jq '.data.rapid' <<< $GASNOW_RESPONSE) / 1000000000 )) + fast=$(( $(jq '.data.fast' <<< $GASNW_RESPONSE) / 1000000000 )) + standard=$(( $(jq '.data.standard' <<< $GASNOW_RESPONSE) / 1000000000 )) + slow=$(( $(jq '.data.slow' <<< $GASNOW_RESPONSE) / 1000000000 )) + echo "Gas prices from ${TPUT_BOLD}gasnow.org${TPUT_RESET}: https://www.gasnow.org" + echo " \ + ${TPUT_RED}Rapid: $rapid gwei ${TPUT_RESET} + ${TPUT_YELLOW}Fast: $fast gwei + ${TPUT_BLUE}Standard: $standard gwei + ${TPUT_GREEN}Slow: $slow gwei${TPUT_RESET}" | column -t +fi +PROVIDER_GAS_PRICE=$(( $(seth rpc eth_gasPrice) / 1000000000 )) +if [[ $PROVIDER_GAS_PRICE -ge $rapid ]];then + COLOR=${TPUT_RED} +elif [[ $PROVIDER_GAS_PRICE -ge $fast ]];then + COLOR=${TPUT_YELLOW} +elif [[ $PROVIDER_GAS_PRICE -ge $standard ]];then + COLOR=${TPUT_BLUE} +else + COLOR=${TPUT_GREEN} +fi +echo "Gas price from your RPC endpoint: ${COLOR}${PROVIDER_GAS_PRICE} gwei${TPUT_RESET}" + +O