Skip to content

Commit de4a4b8

Browse files
chore: add mainnet and opt fork urls to .env.example (#1)
1 parent 7dfb4c3 commit de4a4b8

File tree

3 files changed

+93
-2
lines changed

3 files changed

+93
-2
lines changed

.env.example

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
SEPOLIA_RPC_URL=
2-
ETHERSCAN_API_KEY=
31
PRIVATE_KEY=
42
ACCOUNT_ADDRESS=
3+
MAINNET_FORK_URL=
4+
OPT_FORK_URL=
5+
SEPOLIA_RPC_URL=<YOUR_ETHERSCAN_API_KEY>
6+
DEV_PRIVATE_KEY=0x123
7+
ETHERSCAN_API_KEY=<YOUR_ETHERSCAN_API_KEY>
8+
CHAIN_ID=11155111

script/deploy.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# effect the env vars
4+
source .env
5+
6+
# get bash arg
7+
while [[ "$#" -gt 0 ]]; do
8+
case $1 in
9+
--file) SCRIPT_FILE="$2"; shift ;;
10+
--account) ACCOUNT="$2"; shift ;;
11+
*) echo "unknown arg: $1" ; exit 1 ;;
12+
esac
13+
shift
14+
done
15+
16+
# make sure the script file was provided
17+
if [[ -z "$SCRIPT_FILE" ]]; then
18+
echo "Please specify --file <your_script_path>"
19+
exit 1
20+
fi
21+
22+
if [[ -z "$ACCOUNT" ]]; then
23+
echo "Please specify --account <your_cast_wallet_account>"
24+
exit 1
25+
fi
26+
27+
# check if the environment variables were defined previously
28+
if [[ -z "$SEPOLIA_RPC_URL" || -z "$ETHERSCAN_API_KEY" || -z "$CHAIN_ID" ]]; then
29+
echo "Please ensure .env defines the vars:SEPOLIA_RPC_URL, ETHERSCAN_API_KEY, CHAIN_ID"
30+
exit 1
31+
fi
32+
33+
if [[ -z "$PRIVATE_KEY" ]]; then
34+
echo "Can not load the private key from keystore..."
35+
exit 1
36+
fi
37+
38+
# deploy
39+
forge script "$SCRIPT_FILE" \
40+
--rpc-url "$SEPOLIA_RPC_URL" \
41+
--broadcast \
42+
--verify \
43+
--etherscan-api-key "$ETHERSCAN_API_KEY" \
44+
--account $ACCOUNT \
45+
-vvvv
46+
47+
# 导入钱包私钥到-keystore
48+
# cast wallet import Metamask -i
49+
# cast wallet list
50+
# cat ~/.foundry/keystores/Metamask
51+
52+
# 使用编写好的bash脚本
53+
54+
# --file 参数指定要部署的文件 例如 -file script/DeployMyToken.s.sol:DeployMyToken
55+
# --account 参数指定你用cast wallet import 的 account
56+
# 在部署的过程中会问询你输入创建account时的密码
57+
58+
# bash ./script/deploy.sh --file script/DeployMyToken.s.sol:DeployMyToken --account Metamask

slither.config.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"detectors_to_exclude": [
3+
"assembly",
4+
"solc-version",
5+
"naming-convention",
6+
"incorrect-equality",
7+
"uninitialized-local",
8+
"timestamp",
9+
"low-level-calls",
10+
"unimplemented-functions",
11+
"too-many-digits",
12+
"similar-names",
13+
"calls-loop",
14+
"arbitrary-send-eth",
15+
"reentrancy-no-eth",
16+
"reentrancy-benign",
17+
"reentrancy-events",
18+
"unused-state"
19+
],
20+
"filter_paths": ["lib/", "test/", "mocks/", "BytesLib/", "script/"],
21+
"solc_remaps": [
22+
"forge-std/=lib/forge-std/src/",
23+
"@openzeppelin/=lib/openzeppelin-contracts/",
24+
"@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/"
25+
],
26+
"solc_version": "0.8.20",
27+
"exclude_test_files": true,
28+
"exclude_mock_files": true
29+
}

0 commit comments

Comments
 (0)