From 5c4ba574af8d9f53167343f4367ce8ba32b8286b Mon Sep 17 00:00:00 2001 From: xhad Date: Thu, 11 Apr 2024 09:07:22 -0400 Subject: [PATCH] Adds autoverify script --- Makefile | 2 ++ auto-verify.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ script/Actors.sol | 4 ++-- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 auto-verify.sh diff --git a/Makefile b/Makefile index c52d11b5c..72f3c2dde 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ ci-test :; forge test --rpc-url ${rpc} --summary --detailed --gas-report # Build and Deploy +build :; forge build + deploy-protocol :; forge script script/DeployYieldNest.s.sol:DeployYieldNest --rpc-url ${rpc} --broadcast --etherscan-api-key ${key} --verify # Verify diff --git a/auto-verify.sh b/auto-verify.sh new file mode 100644 index 000000000..d0a7de55a --- /dev/null +++ b/auto-verify.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Change these values as needed +chain=$CHAIN # e.g. mainnet, holesky +rpc=$RPC_URL +api_key=$ETHERSCAN_API_KEY +json_file="broadcast/DeployYieldNest.s.sol/17000/run-latest.json" + +# Extract contract names and addresses to an intermediate file for processing +jq -r '.transactions[] | "\(.contractName) \(.contractAddress)"' $json_file > contracts_to_verify.txt + +# Read each line from the intermediate file +while IFS= read -r line; do + # Split the line into name and address + read -ra ADDR <<< "$line" + contract_name="${ADDR[0]}" + contract_address="${ADDR[1]}" + + # Skip if contract_name or contract_address is empty + if [ -z "$contract_name" ] || [ -z "$contract_address" ]; then + continue + fi + + echo "Verifying $contract_name at $contract_address" + + path=src/$contract_name.sol:$contract_name + + # if the contract name is TransparentUpgradeableProxy, we need to verify the implementation contract + if [ "$contract_name" == "TransparentUpgradeableProxy" ]; then + # Get the implementation address + path=lib/openzeppelin-contracts/contracts/proxy/transparent/$contract_name.sol:$contract_name + fi + + echo "Path: $path" + # Add your forge verify-contract command below, customize it as needed + forge verify-contract --guess-constructor-args --compiler-version v0.8.24+commit.e11b9ed9 --num-of-optimizations 200 --chain-id $chain $contract_address $path --rpc-url $rpc --api-key $api_key --watch + # Note: You'll need to replace placeholders with actual values suitable for your contracts + +done < contracts_to_verify.txt + +# Cleanup intermediate file +rm contracts_to_verify.txt \ No newline at end of file diff --git a/script/Actors.sol b/script/Actors.sol index 57abd4814..927c22e8e 100644 --- a/script/Actors.sol +++ b/script/Actors.sol @@ -22,8 +22,8 @@ contract ActorAddresses { constructor() { actors[17000] = Actors({ // EOA Deployment Addresses - DEFAULT_SIGNER: 0x72fdBD51085bDa5eEEd3b55D1a46E2e92f0837a5, - DEPOSIT_BOOTSTRAPPER: 0x72fdBD51085bDa5eEEd3b55D1a46E2e92f0837a5, + DEFAULT_SIGNER: 0xF2895e90043f58508f7CDBC8D115435245caD2c5, + DEPOSIT_BOOTSTRAPPER: 0xF2895e90043f58508f7CDBC8D115435245caD2c5, // protocol fee receiver FEE_RECEIVER: 0xa9295EA69DaF30A8CB81610c23966240BdDA2876, // admin multisig roles