Skip to content

Commit

Permalink
chain name
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam committed Jun 26, 2024
1 parent c2e2cfb commit 846de8a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 66 deletions.
66 changes: 29 additions & 37 deletions contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,38 @@ CREATE2_SALT=
### The owner of the SP1 Verifier Gateway. This is the account that will be able to add and freeze routes.
OWNER=

### The chains to deploy to, specified by chain ID (e.g. CHAINS=1,11155111,17000)
CHAIN_IDS=
### The chains to deploy to, specified by chain name (e.g. CHAINS=mainnet,sepolia,arbitrum_sepolia)
CHAINS=

### RPCs for each chain ID
RPC_1=
RPC_11155111=
RPC_17000=
RPC_100=
RPC_137=
RPC_42161=
RPC_421614=
RPC_8453=
RPC_84532=
RPC_534352=
RPC_534351=
RPC_MAINNET=
RPC_SEPOLIA=
RPC_HOLESKY=
RPC_ARBITRUM=
RPC_ARBITRUM_SEPOLIA=
RPC_BASE=
RPC_BASE_SEPOLIA=
RPC_SCROLL=
RPC_SCROLL_SEPOLIA=

# Etherscan API keys for each chain ID
ETHERSCAN_API_KEY_1=
ETHERSCAN_API_KEY_11155111=
ETHERSCAN_API_KEY_17000=
ETHERSCAN_API_KEY_100=
ETHERSCAN_API_KEY_137=
ETHERSCAN_API_KEY_42161=
ETHERSCAN_API_KEY_421614=
ETHERSCAN_API_KEY_8453=
ETHERSCAN_API_KEY_84532=
ETHERSCAN_API_KEY_534352=
ETHERSCAN_API_KEY_534351=
ETHERSCAN_API_KEY_MAINNET=
ETHERSCAN_API_KEY_SEPOLIA=
ETHERSCAN_API_KEY_HOLESKY=
ETHERSCAN_API_KEY_ARBITRUM=
ETHERSCAN_API_KEY_ARBITRUM_SEPOLIA=
ETHERSCAN_API_KEY_BASE=
ETHERSCAN_API_KEY_BASE_SEPOLIA=
ETHERSCAN_API_KEY_SCROLL=
ETHERSCAN_API_KEY_SCROLL_SEPOLIA=

# Etherscan API URLs for each chain ID
ETHERSCAN_API_URL_1=https://api.etherscan.io/api
ETHERSCAN_API_URL_5=https://api-goerli.etherscan.io/api
ETHERSCAN_API_URL_17000=https://api-holesky.etherscan.io/api
ETHERSCAN_API_URL_11155111=https://api-sepolia.etherscan.io/api
ETHERSCAN_API_URL_100=https://api.gnosisscan.io/api
ETHERSCAN_API_URL_137=https://api.polygonscan.com/api
ETHERSCAN_API_URL_420=https://api-optimistic.etherscan.io/api
ETHERSCAN_API_URL_42161=https://api.arbiscan.io/api
ETHERSCAN_API_URL_421614=https://api-sepolia.arbiscan.io/api
ETHERSCAN_API_URL_8453=https://api.basescan.org/api
ETHERSCAN_API_URL_84532=https://api-sepolia.basescan.org/api
ETHERSCAN_API_URL_534352=https://api.scrollscan.com/api
ETHERSCAN_API_URL_534351=https://api-sepolia.scrollscan.com/api
ETHERSCAN_API_URL_MAINNET=https://api.etherscan.io/api
ETHERSCAN_API_URL_HOLESKY=https://api-holesky.etherscan.io/api
ETHERSCAN_API_URL_SEPOLIA=https://api-sepolia.etherscan.io/api
ETHERSCAN_API_URL_ARBITRUM=https://api.arbiscan.io/api
ETHERSCAN_API_URL_ARBITRUM_SEPOLIA=https://api-sepolia.arbiscan.io/api
ETHERSCAN_API_URL_BASE=https://api.basescan.org/api
ETHERSCAN_API_URL_BASE_SEPOLIA=https://api-sepolia.basescan.org/api
ETHERSCAN_API_URL_SCROLL=https://api.scrollscan.com/api
ETHERSCAN_API_URL_SCROLL_SEPOLIA=https://api-sepolia.scrollscan.com/api
40 changes: 18 additions & 22 deletions contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,23 @@ ignore = ["lib/**"]
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

[rpc_endpoints]
1 = "${RPC_1}"
11155111 = "${RPC_11155111}"
17000 = "${RPC_17000}"
100 = "${RPC_100}"
137 = "${RPC_137}"
42161 = "${RPC_42161}"
421614 = "${RPC_421614}"
8453 = "${RPC_8453}"
84532 = "${RPC_84532}"
534352 = "${RPC_534352}"
534351 = "${RPC_534351}"
mainnet = "${RPC_MAINNET}"
sepolia = "${RPC_SEPOLIA}"
holesky = "${RPC_HOLESKY}"
arbitrum = "${RPC_ARBITRUM}"
arbitrum_sepolia = "${RPC_ARBITRUM_SEPOLIA}"
base = "${RPC_BASE}"
base_sepolia = "${RPC_BASE_SEPOLIA}"
scroll = "${RPC_SCROLL}"
scroll_sepolia = "${RPC_SCROLL_SEPOLIA}"

[etherscan]
1 = { key = "${ETHERSCAN_API_KEY_1}", url = "${ETHERSCAN_API_URL_1}" }
11155111 = { key = "${ETHERSCAN_API_KEY_11155111}", url = "${ETHERSCAN_API_URL_11155111}" }
17000 = { key = "${ETHERSCAN_API_KEY_17000}", url = "${ETHERSCAN_API_URL_17000}" }
100 = { key = "${ETHERSCAN_API_KEY_100}", url = "${ETHERSCAN_API_URL_100}" }
137 = { key = "${ETHERSCAN_API_KEY_137}", url = "${ETHERSCAN_API_URL_137}" }
42161 = { key = "${ETHERSCAN_API_KEY_42161}", url = "${ETHERSCAN_API_URL_42161}" }
421614 = { key = "${ETHERSCAN_API_KEY_421614}", url = "${ETHERSCAN_API_URL_421614}" }
8453 = { key = "${ETHERSCAN_API_KEY_8453}", url = "${ETHERSCAN_API_URL_8453}" }
84532 = { key = "${ETHERSCAN_API_KEY_84532}", url = "${ETHERSCAN_API_URL_84532}" }
534352 = { key = "${ETHERSCAN_API_KEY_534352}", url = "${ETHERSCAN_API_URL_534352}" }
534351 = { key = "${ETHERSCAN_API_KEY_534351}", url = "${ETHERSCAN_API_URL_534351}" }
mainnet = { key = "${ETHERSCAN_API_KEY_MAINNET}", url = "${ETHERSCAN_API_URL_MAINNET}" }
sepolia = { key = "${ETHERSCAN_API_KEY_SEPOLIA}", url = "${ETHERSCAN_API_URL_SEPOLIA}" }
holesky = { key = "${ETHERSCAN_API_KEY_HOLESKY}", url = "${ETHERSCAN_API_URL_HOLESKY}" }
arbitrum = { key = "${ETHERSCAN_API_KEY_ARBITRUM}", url = "${ETHERSCAN_API_URL_ARBITRUM}" }
arbitrum_sepolia = { key = "${ETHERSCAN_API_KEY_ARBITRUM_SEPOLIA}", url = "${ETHERSCAN_API_URL_ARBITRUM_SEPOLIA}" }
base = { key = "${ETHERSCAN_API_KEY_BASE}", url = "${ETHERSCAN_API_URL_BASE}" }
base_sepolia = { key = "${ETHERSCAN_API_KEY_BASE_SEPOLIA}", url = "${ETHERSCAN_API_URL_BASE_SEPOLIA}" }
scroll = { key = "${ETHERSCAN_API_KEY_SCROLL}", url = "${ETHERSCAN_API_URL_SCROLL}" }
scroll_sepolia = { key = "${ETHERSCAN_API_KEY_SCROLL_SEPOLIA}", url = "${ETHERSCAN_API_URL_SCROLL_SEPOLIA}" }
14 changes: 7 additions & 7 deletions contracts/script/utils/Base.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ abstract contract BaseScript is Script {
vm.stopBroadcast();
}

/// @notice When used, runs the script on the chains specified in the `CHAIN_IDS` env variable.
/// Must have a `RPC_${CHAIN_ID}` env variable set for each chain.
/// @notice When used, runs the script on the chains specified in the `CHAINS` env variable.
/// Must have a `RPC_${CHAIN}` env variable set for each chain (e.g. RPC_MAINNET).
modifier multichain(string memory KEY) {
uint256[] memory chainIds = vm.envUint("CHAIN_IDS", ",");
for (uint256 i = 0; i < chainIds.length; i++) {
uint256 chainId = chainIds[i];
string[] memory chains = vm.envString("CHAINS", ",");
for (uint256 i = 0; i < chains.length; i++) {
string memory chain = chains[i];

// Switch to the chain using the RPC
vm.createSelectFork(vm.toString(chainId));
vm.createSelectFork(chain);

console.log("Deploying %s to chain %s", KEY, vm.toString(block.chainid));
console.log("Deploying %s to %s", KEY, chain);

_;
}
Expand Down

0 comments on commit 846de8a

Please sign in to comment.