Skip to content

Commit

Permalink
chore(contracts): move away from infura key to full rpc url
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed May 1, 2024
1 parent c53cbee commit d8c39e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
14 changes: 11 additions & 3 deletions contracts/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
MNEMONIC=
# api key for eth mainnet etherscan
ETH_ETHERSCAN_API_KEY=
# api key for optimism mainnet etherscan
OPTIMISM_ETHERSCAN_API_KEY=
INFURA_KEY=
OP_RPC_URL=
GAS_PRICE=
# RPC url to talk to optimism mainnet
SEPOLIA_RPC_URL=
# RPC url to talk to optimism sepolia
OP_SEPOLIA_RPC_URL=
# Forking url for testing
FORKING_URL=
# Gas price to use for transactions
GAS_PRICE=
# Block number to fork from
FORKING_BLOCK_NUM=
# Hardhat logging level (true/false)
HARDHAT_LOGGING=
9 changes: 5 additions & 4 deletions contracts/tasks/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const GWEI = 1e9;
export const STATE_TREE_ARITY = 5;

/**
* Convert gas price from gwei to wei
* Convert gas price from gweguari to wei
*
* @param value - gas price in gwei
* @returns gas price in wei
Expand All @@ -46,11 +46,12 @@ export const NETWORKS_DEFAULT_GAS: Record<ESupportedChains, number | "auto"> = {
* @returns {Record<ESupportedChains, string>} rpc urls for supported networks
*/
export const getNetworkRpcUrls = (): Record<ESupportedChains, string> => {
const INFURA_KEY = process.env.INFURA_KEY ?? "";
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL ?? "";
const OP_SEPOLIA_RPC_URL = process.env.OP_SEPOLIA_RPC_URL ?? "";

return {
[ESupportedChains.Sepolia]: `https://sepolia.infura.io/v3/${INFURA_KEY}`,
[ESupportedChains.OptimismSepolia]: `https://optimism-sepolia.infura.io/v3/${INFURA_KEY}`,
[ESupportedChains.Sepolia]: SEPOLIA_RPC_URL,
[ESupportedChains.OptimismSepolia]: OP_SEPOLIA_RPC_URL,
[ESupportedChains.Coverage]: "http://localhost:8555",
[ESupportedChains.Hardhat]: "http://localhost:8545",
};
Expand Down

0 comments on commit d8c39e8

Please sign in to comment.