Skip to content

Commit

Permalink
Adds autoverify script
Browse files Browse the repository at this point in the history
  • Loading branch information
xhad committed Apr 11, 2024
1 parent 729b591 commit 5c4ba57
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions auto-verify.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions script/Actors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c4ba57

Please sign in to comment.