-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathhardhat.config.ts
More file actions
78 lines (75 loc) · 2.47 KB
/
hardhat.config.ts
File metadata and controls
78 lines (75 loc) · 2.47 KB
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
import { HardhatUserConfig, subtask } from "hardhat/config";
import "@typechain/hardhat";
import "@nomiclabs/hardhat-ethers";
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomiclabs/hardhat-web3";
import {
TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD,
} from "hardhat/builtin-tasks/task-names";
import { config as dotenvConfig } from "dotenv";
import { execSync } from "child_process";
dotenvConfig();
// The built-in compiler (auto-downloaded if not yet present) can be overridden by setting SOLC
// If set, we assume it's a native compiler which matches the required Solidity version.
subtask(TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD).setAction(
async (args, hre, runSuper) => {
console.log("subtask TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD");
if (process.env.SOLC !== undefined) {
const versionOutput = execSync(`${process.env.SOLC} --version`, { encoding: 'utf8' }).trim();
const longVersion = versionOutput.match(/Version: (.+)/)?.[1] || `${args.solcVersion}+commit.unknown.Linux.g++`;
console.log(
"Using Solidity compiler set in SOLC:",
process.env.SOLC,
", longVersion:",
longVersion
);
return {
compilerPath: process.env.SOLC,
isSolcJs: false, // false for native compiler
version: args.solcVersion,
longVersion,
};
} else {
// fall back to the default
return runSuper();
}
}
);
/**
* This Hardhat config is only used for testing the SDK-Core.
* Note: For tests to work, 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
* must be the deployer of the contracts.
*/
const config: HardhatUserConfig = {
solidity: {
version: "0.8.23",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
networks: {
hardhat: {
chainId: 31337,
allowUnlimitedContractSize: true,
},
matic: {
url: process.env.MATIC_PROVIDER_URL || "",
chainId: 137,
},
bsc: {
url: process.env.BSC_PROVIDER_URL || "",
accounts: process.env.TEST_PRIVATE_KEY
? [process.env.TEST_PRIVATE_KEY || ""]
: [],
chainId: 56,
},
},
mocha: {
timeout: 250000,
},
typechain: {target: "ethers-v5"},
};
export default config;