mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-08 05:43:57 -05:00
103 lines
2.9 KiB
TypeScript
103 lines
2.9 KiB
TypeScript
import { HardhatUserConfig } from 'hardhat/types';
|
|
import { accounts } from './helpers/test-wallets';
|
|
import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from './helpers/types';
|
|
import { HARDHATEVM_CHAINID } from './helpers/hardhat-constants';
|
|
import { NETWORKS_RPC_URL } from './helper-hardhat-config';
|
|
import dotenv from 'dotenv';
|
|
import glob from 'glob';
|
|
import path from 'path';
|
|
dotenv.config({ path: '../.env' });
|
|
|
|
import '@nomiclabs/hardhat-ethers';
|
|
import '@nomiclabs/hardhat-etherscan';
|
|
import '@typechain/hardhat';
|
|
import 'solidity-coverage';
|
|
import 'hardhat-gas-reporter';
|
|
import 'hardhat-contract-sizer';
|
|
import 'hardhat-log-remover';
|
|
import 'hardhat-spdx-license-identifier';
|
|
|
|
if (!process.env.SKIP_LOAD) {
|
|
glob.sync('./tasks/**/*.ts').forEach(function (file) {
|
|
require(path.resolve(file));
|
|
});
|
|
}
|
|
|
|
const DEFAULT_BLOCK_GAS_LIMIT = 12450000;
|
|
const MNEMONIC_PATH = "m/44'/60'/0'/0";
|
|
const MNEMONIC = process.env.MNEMONIC || '';
|
|
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
|
|
const TRACK_GAS = process.env.TRACK_GAS === 'true';
|
|
const BLOCK_EXPLORER_KEY = process.env.BLOCK_EXPLORER_KEY || '';
|
|
|
|
const getCommonNetworkConfig = (networkName: eNetwork, networkId: number) => ({
|
|
url: NETWORKS_RPC_URL[networkName],
|
|
accounts: {
|
|
mnemonic: MNEMONIC,
|
|
path: MNEMONIC_PATH,
|
|
initialIndex: 0,
|
|
count: 20,
|
|
},
|
|
});
|
|
|
|
const mainnetFork = MAINNET_FORK
|
|
? {
|
|
blockNumber: 12012081,
|
|
url: NETWORKS_RPC_URL['main'],
|
|
}
|
|
: undefined;
|
|
|
|
const config: HardhatUserConfig = {
|
|
solidity: {
|
|
compilers: [
|
|
{
|
|
version: '0.8.10',
|
|
settings: {
|
|
optimizer: {
|
|
enabled: true,
|
|
runs: 200,
|
|
details: {
|
|
yul: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
networks: {
|
|
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
|
|
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
|
|
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
|
|
tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.tenderlyMain, 3030),
|
|
matic: getCommonNetworkConfig(ePolygonNetwork.matic, 137),
|
|
mumbai: getCommonNetworkConfig(ePolygonNetwork.mumbai, 80001),
|
|
xdai: getCommonNetworkConfig(eXDaiNetwork.xdai, 100),
|
|
hardhat: {
|
|
hardfork: 'london',
|
|
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
|
gas: DEFAULT_BLOCK_GAS_LIMIT,
|
|
gasPrice: 8000000000,
|
|
chainId: HARDHATEVM_CHAINID,
|
|
throwOnTransactionFailures: true,
|
|
throwOnCallFailures: true,
|
|
accounts: accounts.map(({ secretKey, balance }: { secretKey: string; balance: string }) => ({
|
|
privateKey: secretKey,
|
|
balance,
|
|
})),
|
|
forking: mainnetFork,
|
|
},
|
|
},
|
|
gasReporter: {
|
|
enabled: TRACK_GAS,
|
|
},
|
|
spdxLicenseIdentifier: {
|
|
overwrite: false,
|
|
runOnCompile: false,
|
|
},
|
|
etherscan: {
|
|
apiKey: BLOCK_EXPLORER_KEY,
|
|
},
|
|
};
|
|
|
|
export default config;
|