Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Added new flexible fork script, small change to .env to match pattern…
Browse files Browse the repository at this point in the history
… of other rpcs
  • Loading branch information
stevieraykatz committed Sep 19, 2023
1 parent 3970403 commit ba60c95
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Etherscan explorer API config
## Etherscan and RPC url config
ETHERSCAN_API_KEY="put your key here plz"
MAINNET_URL="https://api.etherscan.io/"
GOERLI_RPC_URL="https://api-goerli.etherscan.io/"
MAINNET_RPC_URL="MAINNET RPC URL"
GOERLI_RPC_URL="GOERLI RPC URL"

## Polyscan explorer API config
## Polyscan and RPC url config
POLYSCAN_API_KEY="put your key here plz"
POLYGON_RPC_URL="https://api.polygonscan.com/"
MUMBAI_RPC_URL="https://api-testnet.polygonscan.com/"
POLYGON_RPC_URL="POLYGON RPC URL"
MUMBAI_RPC_URL="MUMBAI RPC URL"

##Solidity config settings
OPTIMIZER_FLAG=true
Expand Down
2 changes: 1 addition & 1 deletion config/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ETHERSCAN_API_KEY = extractString("ETHERSCAN_API_KEY");
const GOERLI_RPC_URL = extractString("GOERLI_RPC_URL");
const GANACHE_PRIVATE_KEY = extractString("GANACHE_PRIVATE_KEY");
const GANACHE_RPC_URL = extractString("GANACHE_RPC_URL");
const MAINNET_RPC_URL = extractString("MAINNET_URL");
const MAINNET_RPC_URL = extractString("MAINNET_RPC_URL");
const MUMBAI_RPC_URL = extractString("MUMBAI_RPC_URL");
const POLYGON_RPC_URL = extractString("POLYGON_RPC_URL");
const POLYSCAN_API_KEY = extractString("POLYSCAN_API_KEY");
Expand Down
19 changes: 19 additions & 0 deletions fork.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# turn logging on
set -x;

if [ "$1" == "mumbai" ]; then
rpc=$(grep MUMBAI_RPC_URL .env | cut -d '=' -f2 | sed -e 's/^\"//' -e 's/\"$//');
elif [ "$1" == "polygon" ]; then
rpc=$(grep POLYGON_RPC_URL .env | cut -d '=' -f2 | sed -e 's/^\"//' -e 's/\"$//');
elif [ "$1" == "goerli" ]; then
rpc=$(grep GOERLI_RPC_URL .env | cut -d '=' -f2 | sed -e 's/^\"//' -e 's/\"$//');
elif [ "$1" == "mainnet" ]; then
rpc=$(grep MAINNET_RPC_URL .env | cut -d '=' -f2 | sed -e 's/^\"//' -e 's/\"$//');
else
echo ERROR: Select valid option from {mumbai, polygon, goerli, mainnet}
exit 1;
fi

hardhat node --fork $rpc
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"preinstall": "npx only-allow yarn",
"format": "prettier --write './{config,contracts,eth-sdk,scripts,tasks,test,utils}/**/*.{ts,js,sol}'",
"fork": "hardhat node --fork $(grep MUMBAI_RPC_URL .env | cut -d '=' -f2 | sed -e 's/^\"//' -e 's/\"$//')",
"fork": "bash ./fork.sh",
"test": "hardhat test",
"compile": "bash ./compile.sh",
"deploy": "hardhat compile && hardhat deploy:AngelProtocol",
Expand Down

0 comments on commit ba60c95

Please sign in to comment.