diff --git a/verifyLestnet.sh b/verifyLestnet.sh index 4f613bd..1376a9c 100755 --- a/verifyLestnet.sh +++ b/verifyLestnet.sh @@ -6,7 +6,20 @@ CONTRACT=$1 # Get contract address ADDRESS=$2 -# TODO: Add conditional logic for constructor arguments and make ot modular with other explorers +echo "Enter constructor signature (Enter to skip)" +read CONSTRUCTOR_SIG # e.g. constructor(uint256,address) + +if [ -n "$CONSTRUCTOR_SIG" ] +then + echo "Enter constructor arguments" + read CONSTRUCTOR_ARGS # e.g. 111111 0x0000000000000000000000000000000000000001 +fi source .env -forge verify-contract --rpc-url $LESTNET_RPC $ADDRESS $CONTRACT --verifier blockscout --verifier-url $LESTNET_API_KEY + +if [ -z "$CONSTRUCTOR_SIG" ]; then + forge verify-contract --rpc-url $LESTNET_RPC $ADDRESS $CONTRACT --verifier blockscout --verifier-url $LESTNET_API_KEY +else + ENCODED_ARGS=$(cast abi-encode "$CONSTRUCTOR_SIG" $CONSTRUCTOR_ARGS) + forge verify-contract --rpc-url $LESTNET_RPC "$ADDRESS" "$CONTRACT" --constructor-args "$ENCODED_ARGS" --verifier blockscout --verifier-url $LESTNET_API_KEY +fi \ No newline at end of file