From 4926e8b897fd34108f5c7bfc23e1e92f8d2b003e Mon Sep 17 00:00:00 2001 From: Robert Tera <37669800+scolear@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:09:47 +0200 Subject: [PATCH] multi-chain-scripts initial setup (#111) * multi-chain-scripts initial setup * chore: clean up hardhat config --- hardhat.config.js | 21 ++++++++++++++++----- scripts/helpers/mainnet-call-all.sh | 15 +++++++++++++++ scripts/helpers/new-chain-setup-mainnet.sh | 2 ++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100755 scripts/helpers/mainnet-call-all.sh diff --git a/hardhat.config.js b/hardhat.config.js index d67f06c..c69737c 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -5,16 +5,27 @@ require('@openzeppelin/hardhat-upgrades'); require('@nomiclabs/hardhat-solhint'); require('dotenv').config(); -const arbitrumURL = process.env.ARB_NODE_ADDR ?? 'https://arb1.arbitrum.io/rpc'; +const mainnetURL = + process.env.MAINNET_NODE_ADDR ?? + `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`; +const sepoliaURL = + process.env.SEPOLIA_NODE_ADDR ?? + `https://eth-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`; +const arbitrumURL = + process.env.ARB_NODE_ADDR ?? + `https://arb-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`; const arbSepoliaURL = process.env.ARB_SEPOLIA_NODE_ADDR ?? - 'https://sepolia-rollup.arbitrum.io/rpc'; + `https://arb-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`; const baseURL = process.env.BASE_NODE_ADDR ?? `https://base-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`; const baseSepoliaURL = process.env.BASE_SEPOLIA_NODE_ADDR ?? `https://base-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`; +const optimismURL = + process.env.OPTIMISM_NODE_ADDR ?? + `https://opt-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`; const deployerKey = process.env.SCRIPT_KEY ?? process.env.KEY; module.exports = { @@ -36,12 +47,12 @@ module.exports = { gasPrice: 0x01, }, mainnet: { - url: `https://mainnet.infura.io/v3/${process.env.INFURA_PROJECT_ID}`, + url: mainnetURL, chainId: 1, accounts: [deployerKey], }, sepolia: { - url: `https://sepolia.infura.io/v3/${process.env.INFURA_PROJECT_ID}`, + url: sepoliaURL, chainId: 11155111, accounts: [deployerKey], }, @@ -61,7 +72,7 @@ module.exports = { accounts: [deployerKey], }, optimism: { - url: `https://optimism-mainnet.infura.io/v3/${process.env.INFURA_PROJECT_ID}`, + url: optimismURL, chainId: 10, accounts: [deployerKey], }, diff --git a/scripts/helpers/mainnet-call-all.sh b/scripts/helpers/mainnet-call-all.sh new file mode 100755 index 0000000..431b6e9 --- /dev/null +++ b/scripts/helpers/mainnet-call-all.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Check if the command line argument is provided +if [ $# -eq 0 ]; then + echo "Please provide a command argument." + exit 1 +fi + +# Assign the command line argument to a variable +command=$1 +extra_args="${@:2}" + +HARDHAT_NETWORK=base dlc-link-eth $command $extra_args +HARDHAT_NETWORK=arbitrum dlc-link-eth $command $extra_args +HARDHAT_NETWORK=mainnet dlc-link-eth $command $extra_args diff --git a/scripts/helpers/new-chain-setup-mainnet.sh b/scripts/helpers/new-chain-setup-mainnet.sh index 0f5d620..83de0a6 100755 --- a/scripts/helpers/new-chain-setup-mainnet.sh +++ b/scripts/helpers/new-chain-setup-mainnet.sh @@ -9,6 +9,7 @@ dlc-link-eth add-signer 0x2b16469227cd34F591D455aC81Ca8a1A4bA69F02 # LinkPool dlc-link-eth add-signer 0x5db792d5facb35e9adce8a151e8a3d0d36c9cb77 # HashKey dlc-link-eth add-signer 0x194c697e8343EaB3C53917BA7e597d02687f8BA0 # Despread dlc-link-eth add-signer 0xdf4d8B54dE476B674f1832B95984fFa7e223d47B # PierTwo +dlc-link-eth add-signer 0xAFBc5Dde8a3fEc5234600Ed7fCA541609F3Ed23C # ValidationCloud dlc-link-eth set-attestor-gpk 'xpub6C1F2SwADP3TNajQjg2PaniEGpZLvWdMiFP8ChPjQBRWD1XUBeMdE4YkQYvnNhAYGoZKfcQbsRCefserB5DyJM7R9VR6ce6vLrXHVfeqyH3' @@ -34,3 +35,4 @@ dlc-link-eth whitelist-account 0xf92893654e38b80dfd9b4a2fb99100dd31ba5e2d # Ambe dlc-link-eth whitelist-account 0xff200709bf9bbc5209ba4b5dd767913a8a06b73f # Amber dlc-link-eth whitelist-account 0x46166fA874AAEDEA8d98b15F9A72C84e22Abe2A1 # SBL dlc-link-eth whitelist-account 0x14Ee510Ebd4E5273e83Ad88f6cd2dc228BE40D12 # Tokkalabs +dlc-link-eth whitelist-account 0xFc62319bCdfeDB6e55295F3723005593b16A3f9c # Garden