feat: add more chains in Foundry config

refactor: rename api key env vars
This commit is contained in:
Paul Razvan Berg 2023-03-01 14:15:16 +02:00
parent c80e5a8e0d
commit f5a68d8737
No known key found for this signature in database
GPG Key ID: 94DB130BAB397DED
4 changed files with 29 additions and 12 deletions

View File

@ -1,4 +1,9 @@
ALCHEMY_API_KEY="YOUR_ALCHEMY_API_KEY"
ETHERSCAN_API_KEY="YOUR_ETHERSCAN_API_KEY"
INFURA_API_KEY="YOUR_INFURA_API_KEY"
API_KEY_ALCHEMY="YOUR_ALCHEMY_API_KEY"
API_KEY_ARBISCAN="YOUR_ARBISCAN_API_KEY"
API_KEY_BSCSCAN="YOUR_BSCSCAN_API_KEY"
API_KEY_ETHERSCAN="YOUR_ETHERSCAN_API_KEY"
API_KEY_INFURA="YOUR_INFURA_API_KEY"
API_KEY_OPTIMISTIC_ETHERSCAN="YOUR_OPTIMISTIC_ETHERSCAN_API_KEY"
API_KEY_POLYGONSCAN="YOUR_POLYGONSCAN_API_KEY"
API_KEY_SNOWTRACE="YOUR_SNOWTRACE_API_KEY"
MNEMONIC="YOUR_MNEMONIC"

View File

@ -1,10 +1,10 @@
name: "CI"
env:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
API_KEY_ALCHEMY: ${{ secrets.API_KEY_ALCHEMY }}
API_KEY_ETHERSCAN: ${{ secrets.API_KEY_ETHERSCAN }}
API_KEY_INFURA: ${{ secrets.API_KEY_INFURA }}
FOUNDRY_PROFILE: "ci"
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
MNEMONIC: ${{ secrets.MNEMONIC }}
on:

View File

@ -20,8 +20,14 @@
verbosity = 4
[etherscan]
ethereum = { key = "${ETHERSCAN_API_KEY}" }
goerli = { key = "${ETHERSCAN_API_KEY}" }
arbitrum = { key = "${API_KEY_ARBISCAN}" }
avalanche = { key = "${API_KEY_SNOWTRACE" }
bsc = { key = "${API_KEY_BSCSCAN}" }
ethereum = { key = "${API_KEY_ETHERSCAN}" }
goerli = { key = "${API_KEY_ETHERSCAN}" }
optimism = { key = "${API_KEY_OPTIMISTIC_ETHERSCAN}" }
polygon = { key = "${API_KEY_POLYGONSCAN}" }
sepolia = { key = "${API_KEY_ETHERSCAN}" }
[fmt]
bracket_spacing = true
@ -34,6 +40,12 @@
wrap_comments = true
[rpc_endpoints]
ethereum = "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
goerli = "https://goerli.infura.io/v3/${INFURA_API_KEY}"
arbitrum = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}"
avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}"
bsc = "https://bsc-dataseed.binance.org"
ethereum = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}"
localhost = "http://localhost:8545"
optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}"
polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}"
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"

View File

@ -29,10 +29,10 @@ contract FooTest is PRBTest, StdCheats {
assertGt(x, 0);
}
/// @dev Test that runs against a fork of Ethereum Mainnet. You need to set `ALCHEMY_API_KEY` in your environment
/// @dev Test that runs against a fork of Ethereum Mainnet. You need to set `API_KEY_ALCHEMY` in your environment
/// for this test to run - you can get an API key for free at https://alchemy.com.
function testFork_Example() external {
string memory alchemyApiKey = vm.envOr("ALCHEMY_API_KEY", string(""));
string memory alchemyApiKey = vm.envOr("API_KEY_ALCHEMY", string(""));
// Silently pass this test if the user didn't define the API key.
if (bytes(alchemyApiKey).length == 0) {
return;