-
Notifications
You must be signed in to change notification settings - Fork 691
/
Copy pathconstants.js
224 lines (206 loc) · 6.33 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
import dotenv from "dotenv";
import pkgWeb3 from "web3";
dotenv.config();
export const DEBUG = process.env.NODE_ENV !== "production";
export const DEBUG_REDUX = DEBUG;
export const SENTRY_DSN = process.env.REACT_APP_SENTRY_DSN;
// Networks for operations
export const NETWORKS = {
UNDEFINED: undefined,
LOCAL: {
name: "local",
id: "31337",
url: "http://localhost",
port: 8545,
},
SEPOLIA: {
name: "sepolia",
id: "11155111",
url: `${process.env.SEPOLIA_HOST}`,
privKey: `${process.env.PRIV_KEY}`,
},
OPTIMISM_SEPOLIA: {
name: "sepolia-optimism",
id: "11155420",
url: `${process.env.OPTIMISM_SEPOLIA_HOST}`,
privKey: `${process.env.PRIV_KEY}`,
},
ARBITRUM_SEPOLIA: {
name: "sepolia-arbitrum",
id: "421614",
url: `${process.env.ARBITRUM_SEPOLIA_HOST}`,
privKey: `${process.env.PRIV_KEY}`,
},
HOLESKY: {
name: "holesky",
id: "17000",
url: `${process.env.HOLESKY_HOST}`,
privKey: `${process.env.PRIV_KEY}`,
},
AMOY: {
name: "amoy",
id: "80002",
url: `${process.env.AMOY_HOST}`,
privKey: `${process.env.PRIV_KEY}`,
},
};
// Networks for operations
export const NETWORKS_INGAME = {
UNDEFINED: undefined,
LOCAL: {
name: "local",
id: "31337",
url: "http://localhost",
port: 8545,
},
SEPOLIA: {
name: "sepolia",
id: "11155111",
currencyName: "Sepolia-ETH",
currencySymbol: "SEP",
rpcUrl: `https://rpc.sepolia.org`,
blockExplorer: "https://sepolia.etherscan.io",
explorer: {
apiKey: `${process.env.REACT_APP_SEPOLIA_EXPLORER_API_KEY}`,
apiHost: `https://api-sepolia.etherscan.io`,
},
},
OPTIMISM_SEPOLIA: {
name: "sepolia-optimism",
id: "11155420",
currencyName: "Optimism-ETH",
currencySymbol: "ETH",
rpcUrl: `https://sepolia.optimism.io`,
blockExplorer: "https://sepolia-optimism.etherscan.io",
explorer: {
apiKey: `${process.env.REACT_APP_OPTIMISM_SEPOLIA_EXPLORER_API_KEY}`,
apiHost: `https://api-sepolia-optimistic.etherscan.io`,
},
},
ARBITRUM_SEPOLIA: {
name: "sepolia-arbitrum",
id: "421614",
currencyName: "Arbitrum-ETH",
currencySymbol: "ETH",
rpcUrl: `https://sepolia-rollup.arbitrum.io/rpc`,
blockExplorer: "https://sepolia.arbiscan.io",
explorer: {
apiKey: `${process.env.REACT_APP_ARBITRUM_SEPOLIA_EXPLORER_API_KEY}`,
apiHost: `https://api-sepolia.arbiscan.io`,
},
},
HOLESKY: {
name: "holesky",
id: "17000",
currencyName: "Holesky-ETH",
currencySymbol: "ETH",
rpcUrl: "https://ethereum-holesky.publicnode.com",
blockExplorer: "https://holesky.etherscan.io",
explorer: {
apiKey: `${process.env.REACT_APP_HOLESKY_EXPLORER_API_KEY}`,
apiHost: `https://api-holesky.etherscan.io`,
},
},
AMOY: {
name: "amoy",
id: "80002",
currencyName: "MATIC",
currencySymbol: "MATIC",
rpcUrl: `https://rpc-amoy.polygon.technology/`,
blockExplorer: "https://amoy.polygonscan.com/",
},
};
// Deprectated networks
// status: {deprecated | deprecation-planned}
export const NETWORKS_DEPRECATION = {
GOERLI: {
id: "5",
status: "deprecated",
date: "jan-2024",
},
OPTIMISM_GOERLI: {
id: "420",
status: "deprecated",
date: "jan-2024",
},
ARBITRUM_GOERLI: {
id: "421613",
status: "deprecated",
date: "jan-2024",
},
MUMBAI: {
id: "80001",
status: "deprecated",
date: "april-2024",
},
};
// Web3
export const Web3 = pkgWeb3;
// Misc
export const CLEAR_CONSOLE = !DEBUG;
export const GOOGLE_ANALYTICS_ID = "UA-85043059-4";
// Owner addresses
export const ADDRESSES = {
[NETWORKS.LOCAL.name]: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
[NETWORKS.SEPOLIA.name]: "0x09902A56d04a9446601a0d451E07459dC5aF0820",
[NETWORKS.OPTIMISM_SEPOLIA.name]:
"0x09902A56d04a9446601a0d451E07459dC5aF0820",
[NETWORKS.ARBITRUM_SEPOLIA.name]:
"0x09902A56d04a9446601a0d451E07459dC5aF0820",
[NETWORKS.HOLESKY.name]: "0x09902A56d04a9446601a0d451E07459dC5aF0820",
[NETWORKS.AMOY.name]: "0x09902A56d04a9446601a0d451E07459dC5aF0820",
};
// Support EIP-1559
export const SUPPORTS_EIP_1559 = [
"5", // NETWORKS.GOERLI.id
"80001", // NETWORKS.MUMBAI.id
"11155111", // NETWORKS.SEPOLIA.id
];
// Core contract keys
export const CORE_CONTRACT_NAMES = [
"ethernaut",
"proxyAdmin",
"implementation",
"proxyStats",
];
// Storage
export const VERSION = "0.1.0";
export const STORAGE_PLAYER_DATA_KEY = `ethernaut_player_data_${VERSION}_`;
export const STORAGE_CONTRACT_DATA_KEY = `ethernaut_contract_data_`;
// Paths
export const PATH_ROOT = "/";
export const PATH_NOT_FOUND = "/404";
export const PATH_HELP = "/help";
export const PATH_LEVEL_ROOT = `${PATH_ROOT}level/`;
export const PATH_LEVEL = `${PATH_LEVEL_ROOT}:address`;
export const PATH_STATS = `${PATH_ROOT}stats`;
export const PATH_LEADERBOARD = `${PATH_ROOT}leaderboard`;
// RELEASE SENSITIVE
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
export const CUSTOM_LOGGING = true; /* TRUE on production */
export const SHOW_ALL_COMPLETE_DESCRIPTIONS = false; /* FALSE on production */
export const SHOW_VERSION = true;
// export const ACTIVE_NETWORK = NETWORKS.SEPOLIA
// export const ACTIVE_NETWORK = NETWORKS.MUMBAI
// export const ACTIVE_NETWORK = NETWORKS.OPTIMISM_SEPOLIA
// export const ACTIVE_NETWORK = NETWORKS.ARBITRUM_SEPOLIA
// export const ACTIVE_NETWORK = NETWORKS.HOLESKY
// export const ACTIVE_NETWORK = NETWORKS.AMOY
// export const ACTIVE_NETWORK = NETWORKS.LOCAL;
let id_to_network = {};
Object.keys(NETWORKS)
.filter(
(network) => NETWORKS[network] /*&& NETWORKS[network].name !== 'local'*/
)
.forEach(
(network) => (id_to_network[NETWORKS[network].id] = NETWORKS[network].name)
);
export const ID_TO_NETWORK = id_to_network;
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
export const ALIAS_PATH =
"https://raw.githubusercontent.com/OpenZeppelin/ethernaut-leaderboard/update/boards/aliases.json";
export const getLeaderboardPath = (network) => {
return `https://raw.githubusercontent.com/OpenZeppelin/ethernaut-leaderboard/update/boards/networkleaderboards/${network}LeaderBoard.json`;
};