-
Notifications
You must be signed in to change notification settings - Fork 54
/
hardhat.config.js
106 lines (96 loc) · 2.92 KB
/
hardhat.config.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
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-ethers");
require("hardhat-deploy");
require("hardhat-deploy-ethers");
require("hardhat-abi-exporter");
require("hardhat-contract-sizer");
require("@nomiclabs/hardhat-etherscan");
const dotenv = require("dotenv");
const {task} = require("hardhat/config");
dotenv.config();
const MAINNET_URL = process.env.MAINNET_URL;
const TESTNET_URL = process.env.TESTNET_URL;
const MAINNET_CHAIN_ID = parseInt(process.env.MAINNET_CHAIN_ID);
const TESTNET_CHAIN_ID = parseInt(process.env.TESTNET_CHAIN_ID);
const DEPLOYMENTS_PATH = process.env.DEPLOYMENTS_PATH;
const PK_USER = process.env.PK_USER;
const PK_OWNER = process.env.PK_OWNER;
const PK_TEST = process.env.PK_TEST;
const EXPLORER_API_KEY = process.env.EXPLORER_API_KEY;
// require scripts
const farmData = require("./scripts/farm-data");
const verifyContract = require("./scripts/verify-contract");
// tasks
task("checkFarmState", "Gives a nice output of the state of the farm")
.addParam("farm", "Farm to check the state of")
.setAction(async ({farm}) => farmData(farm));
// to verify all contracts use
// find ./deployments/mainnet -maxdepth 1 -type f -not -path '*/\.*' -path "*.json" | xargs -L1 npx hardhat verifyContract --deployment-file-path
task("verifyContract", "Verifies the contract in the snowtrace")
.addParam("deploymentFilePath", "Deployment file path")
.setAction(async ({deploymentFilePath}, hre) => verifyContract(deploymentFilePath, hre));
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
mocha: {
timeout: 1e10,
},
solidity: {
version: "0.8.13",
settings: {
optimizer: {
enabled: true,
runs: 999,
},
},
},
defaultNetwork: "mainnet",
namedAccounts: {
deployer: {
default: 1,
},
},
contractSizer: {
alphaSort: false,
runOnCompile: false,
disambiguatePaths: false,
},
paths: {
deploy: "deploy",
deployments: DEPLOYMENTS_PATH,
},
abiExporter: {
path: "./abis",
clear: true,
flat: true,
},
etherscan: {
apiKey: EXPLORER_API_KEY,
},
networks: {
hardhat: {
chainId: MAINNET_CHAIN_ID,
throwOnTransactionFailures: false,
loggingEnabled: true,
forking: {
url: MAINNET_URL,
enabled: true,
},
},
mainnet: {
chainId: MAINNET_CHAIN_ID,
gasPrice: 25000000000,
url: MAINNET_URL,
accounts: [PK_USER, PK_OWNER],
},
testnet: {
chainId: TESTNET_CHAIN_ID,
gasPrice: 25000000000,
url: TESTNET_URL,
accounts: [PK_TEST],
},
},
};