generated from agusduha/router-proxy-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
121 lines (109 loc) · 3.06 KB
/
hardhat.config.ts
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
import * as dotenv from "dotenv";
import fs from "fs";
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@synthetixio/router/utils/cannon";
import "@synthetixio/hardhat-storage";
import "hardhat-cannon";
import "hardhat-preprocessor";
import "hardhat-abi-exporter";
import "./tasks/deposit";
import "./tasks/subscribe";
import "./tasks/unsubscribe";
import "./tasks/getBalance";
import "./tasks/createProfile";
import "./tasks/transferProfile";
// Router generation cannon plugin
import { registerAction } from "@usecannon/builder";
registerAction(require("cannon-plugin-router"));
dotenv.config();
const alchemyKey = process.env.ALCHEMY_API_KEY as string;
function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean) // remove empty lines
.map((line) => line.trim().split("="));
}
const config: HardhatUserConfig = {
solidity: {
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
// This fully resolves paths for imports in the ./lib directory for Hardhat
preprocess: {
eachLine: (hre) => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
for (const [from, to] of getRemappings()) {
if (line.includes(from)) {
line = line.replace(from, to);
break;
}
}
}
return line;
},
settings: { comment: true },
files: "./contracts/vaults/*.sol",
}),
},
networks: {
local: {
url: "http://localhost:8545",
chainId: 31337,
accounts: [process.env.LOCAL_PRIVATE_KEY as string],
},
hardhat: {
forking: {
url: process.env.RPC_MUMBAI as string,
blockNumber: 32860318,
},
},
mumbai: {
url: process.env.RPC_MUMBAI as string,
chainId: 80001,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
},
polygon: {
url: `https://polygon-mainnet.g.alchemy.com/v2/${alchemyKey}`,
chainId: 137,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
},
optimismGoerli: {
url: `https://opt-goerli.g.alchemy.com/v2/${alchemyKey}`,
chainId: 420,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
},
optimism: {
url: `https://opt-mainnet.g.alchemy.com/v2/${alchemyKey}`,
chainId: 10,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
},
},
gasReporter: {
enabled: true,
currency: "USD",
coinmarketcap: process.env.COINMARKETCAP_API_KEY as string,
token: "ETH",
gasPrice: 1,
},
cannon: {
publicSourceCode: true,
},
etherscan: {
apiKey: {
polygon: process.env.POLYGON_ETHERSCAN_API_KEY as string,
polygonMumbai: process.env.POLYGON_ETHERSCAN_API_KEY as string,
optimisticGoerli: process.env.OPTIMISTIC_ETHERSCAN_API_KEY as string,
optimisticEthereum: process.env.OPTIMISTIC_ETHERSCAN_API_KEY as string,
},
},
defaultNetwork: "cannon",
};
export default config;