-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add mainnet and opt fork urls to .env.example (#1)
- Loading branch information
1 parent
7dfb4c3
commit de4a4b8
Showing
3 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
SEPOLIA_RPC_URL= | ||
ETHERSCAN_API_KEY= | ||
PRIVATE_KEY= | ||
ACCOUNT_ADDRESS= | ||
MAINNET_FORK_URL= | ||
OPT_FORK_URL= | ||
SEPOLIA_RPC_URL=<YOUR_ETHERSCAN_API_KEY> | ||
DEV_PRIVATE_KEY=0x123 | ||
ETHERSCAN_API_KEY=<YOUR_ETHERSCAN_API_KEY> | ||
CHAIN_ID=11155111 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
|
||
# effect the env vars | ||
source .env | ||
|
||
# get bash arg | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--file) SCRIPT_FILE="$2"; shift ;; | ||
--account) ACCOUNT="$2"; shift ;; | ||
*) echo "unknown arg: $1" ; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
# make sure the script file was provided | ||
if [[ -z "$SCRIPT_FILE" ]]; then | ||
echo "Please specify --file <your_script_path>" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$ACCOUNT" ]]; then | ||
echo "Please specify --account <your_cast_wallet_account>" | ||
exit 1 | ||
fi | ||
|
||
# check if the environment variables were defined previously | ||
if [[ -z "$SEPOLIA_RPC_URL" || -z "$ETHERSCAN_API_KEY" || -z "$CHAIN_ID" ]]; then | ||
echo "Please ensure .env defines the vars:SEPOLIA_RPC_URL, ETHERSCAN_API_KEY, CHAIN_ID" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$PRIVATE_KEY" ]]; then | ||
echo "Can not load the private key from keystore..." | ||
exit 1 | ||
fi | ||
|
||
# deploy | ||
forge script "$SCRIPT_FILE" \ | ||
--rpc-url "$SEPOLIA_RPC_URL" \ | ||
--broadcast \ | ||
--verify \ | ||
--etherscan-api-key "$ETHERSCAN_API_KEY" \ | ||
--account $ACCOUNT \ | ||
-vvvv | ||
|
||
# 导入钱包私钥到-keystore | ||
# cast wallet import Metamask -i | ||
# cast wallet list | ||
# cat ~/.foundry/keystores/Metamask | ||
|
||
# 使用编写好的bash脚本 | ||
|
||
# --file 参数指定要部署的文件 例如 -file script/DeployMyToken.s.sol:DeployMyToken | ||
# --account 参数指定你用cast wallet import 的 account | ||
# 在部署的过程中会问询你输入创建account时的密码 | ||
|
||
# bash ./script/deploy.sh --file script/DeployMyToken.s.sol:DeployMyToken --account Metamask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"detectors_to_exclude": [ | ||
"assembly", | ||
"solc-version", | ||
"naming-convention", | ||
"incorrect-equality", | ||
"uninitialized-local", | ||
"timestamp", | ||
"low-level-calls", | ||
"unimplemented-functions", | ||
"too-many-digits", | ||
"similar-names", | ||
"calls-loop", | ||
"arbitrary-send-eth", | ||
"reentrancy-no-eth", | ||
"reentrancy-benign", | ||
"reentrancy-events", | ||
"unused-state" | ||
], | ||
"filter_paths": ["lib/", "test/", "mocks/", "BytesLib/", "script/"], | ||
"solc_remaps": [ | ||
"forge-std/=lib/forge-std/src/", | ||
"@openzeppelin/=lib/openzeppelin-contracts/", | ||
"@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/" | ||
], | ||
"solc_version": "0.8.20", | ||
"exclude_test_files": true, | ||
"exclude_mock_files": true | ||
} |