-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.ts
More file actions
66 lines (61 loc) · 2.29 KB
/
Copy pathhardhat.config.ts
File metadata and controls
66 lines (61 loc) · 2.29 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
import { HardhatUserConfig } from "hardhat/config";
import "@nomiclabs/hardhat-waffle";
import "@nomicfoundation/hardhat-verify";
import * as dotenv from "dotenv";
dotenv.config();
// Normalize the deployer key (hardhat wants a 0x-prefixed hex private key).
const rawKey = process.env.PRIVATE_KEY_TESTNET || "";
const testnetKey = rawKey ? [rawKey.startsWith("0x") ? rawKey : `0x${rawKey}`] : [];
const bscTestnetRpc =
process.env.BSC_TESTNET_RPC_URL || "https://bsc-testnet-dataseed.bnbchain.org";
/**
* Uniswap V2 uses two Solidity versions:
* - core -> 0.5.16
* - periphery -> 0.6.6
* Shared interfaces (pragma >=0.5.0 / >=0.6.2) are compiled under whichever
* version the importing contract requires. Optimizer settings and EVM target
* mirror the original Uniswap build (999999 runs, istanbul) so the compiled
* bytecode — and therefore gas snapshots and CREATE2 addresses — match.
*/
const optimizer = { enabled: true, runs: 999999 };
const config: HardhatUserConfig = {
solidity: {
compilers: [
{ version: "0.5.16", settings: { optimizer, evmVersion: "istanbul" } },
{ version: "0.6.6", settings: { optimizer, evmVersion: "istanbul" } },
],
},
networks: {
hardhat: {
// Uniswap V2 tests were written against a chainId of 1 (used in the
// EIP-712 domain separator for permit); keep it so digests match.
chainId: 1,
hardfork: "istanbul",
allowUnlimitedContractSize: true,
// Start the chain before 2020 so the sliding-window oracle spec can set
// its absolute start timestamp (1577836800 = 2020-01-01) going forward.
initialDate: "2019-01-01T00:00:00Z",
// The Uniswap oracle specs were written against ganache, where consecutive
// txs in the same real second share a block timestamp. Allow that here so
// setup txs don't drift past the anchored start time.
allowBlocksWithSameTimestamp: true,
},
bscTestnet: {
url: bscTestnetRpc,
chainId: 97,
accounts: testnetKey,
},
},
etherscan: {
// Etherscan V2 unified API — a single key routes to BSC by chainId.
apiKey: process.env.ETHERSCAN_API_KEY || process.env.BSCSCAN_API_KEY || "",
},
paths: {
sources: "./contracts",
tests: "./test",
},
mocha: {
timeout: 200000,
},
};
export default config;