Skip to content

Commit

Permalink
Replicating more tests from Aragon's multisig plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Sep 20, 2023
1 parent 3426c5d commit e53fb19
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 101 deletions.
101 changes: 52 additions & 49 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import {NetworkNameMapping} from './utils/helpers';
import '@nomicfoundation/hardhat-chai-matchers';
import '@nomicfoundation/hardhat-toolbox';
import '@nomiclabs/hardhat-etherscan';
import '@openzeppelin/hardhat-upgrades';
import '@typechain/hardhat';
import {config as dotenvConfig} from 'dotenv';
import 'hardhat-deploy';
import 'hardhat-gas-reporter';
import {extendEnvironment, HardhatUserConfig} from 'hardhat/config';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import type {NetworkUserConfig} from 'hardhat/types';
import {resolve} from 'path';
import 'solidity-coverage';
import { NetworkNameMapping } from "./utils/helpers";
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomicfoundation/hardhat-toolbox";
import "@nomiclabs/hardhat-etherscan";
import "@openzeppelin/hardhat-upgrades";
import "@typechain/hardhat";
import { config as dotenvConfig } from "dotenv";
import "hardhat-deploy";
import "hardhat-gas-reporter";
import { extendEnvironment, HardhatUserConfig } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import type { NetworkUserConfig } from "hardhat/types";
import { resolve } from "path";
import "solidity-coverage";

const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || '../../.env';
dotenvConfig({path: resolve(__dirname, dotenvConfigPath)});
const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || "../../.env";
dotenvConfig({ path: resolve(__dirname, dotenvConfigPath) });

if (!process.env.INFURA_API_KEY) {
throw new Error('INFURA_API_KEY in .env not set');
throw new Error("INFURA_API_KEY in .env not set");
}

const apiUrls: NetworkNameMapping = {
mainnet: 'https://mainnet.infura.io/v3/',
goerli: 'https://goerli.infura.io/v3/',
polygon: 'https://polygon-mainnet.infura.io/v3/',
polygonMumbai: 'https://polygon-mumbai.infura.io/v3/',
baseGoerli: 'https://goerli.base.org',
mainnet: "https://mainnet.infura.io/v3/",
goerli: "https://goerli.infura.io/v3/",
polygon: "https://polygon-mainnet.infura.io/v3/",
polygonMumbai: "https://polygon-mumbai.infura.io/v3/",
baseGoerli: "https://goerli.base.org",
};

export const networks: {[index: string]: NetworkUserConfig} = {
export const networks: { [index: string]: NetworkUserConfig } = {
hardhat: {
chainId: 31337,
forking: {
url: `${
apiUrls[process.env.NETWORK_NAME ? process.env.NETWORK_NAME : 'mainnet']
apiUrls[process.env.NETWORK_NAME ? process.env.NETWORK_NAME : "mainnet"]
}${process.env.INFURA_API_KEY}`,
},
},
Expand Down Expand Up @@ -62,14 +62,14 @@ export const networks: {[index: string]: NetworkUserConfig} = {

// Uses hardhats private key if none is set. DON'T USE THIS ACCOUNT FOR DEPLOYMENTS
const accounts = process.env.PRIVATE_KEY
? process.env.PRIVATE_KEY.split(',')
: ['0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'];
? process.env.PRIVATE_KEY.split(",")
: ["0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"];

for (const network in networks) {
// special treatement for hardhat
if (network.startsWith('hardhat')) {
if (network.startsWith("hardhat")) {
networks[network].accounts = {
mnemonic: 'test test test test test test test test test test test junk',
mnemonic: "test test test test test test test test test test test junk",
};
continue;
}
Expand All @@ -82,26 +82,29 @@ extendEnvironment((hre: HardhatRuntimeEnvironment) => {
});

const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
defaultNetwork: "hardhat",
etherscan: {
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY || '',
goerli: process.env.ETHERSCAN_API_KEY || '',
polygon: process.env.POLYGONSCAN_API_KEY || '',
polygonMumbai: process.env.POLYGONSCAN_API_KEY || '',
baseGoerli: process.env.BASESCAN_API_KEY || '',
mainnet: process.env.ETHERSCAN_API_KEY || "",
goerli: process.env.ETHERSCAN_API_KEY || "",
polygon: process.env.POLYGONSCAN_API_KEY || "",
polygonMumbai: process.env.POLYGONSCAN_API_KEY || "",
baseGoerli: process.env.BASESCAN_API_KEY || "",
},
customChains: [
{
network: 'baseGoerli',
network: "baseGoerli",
chainId: 84531,
urls: {
apiURL: 'https://api-goerli.basescan.org/api',
browserURL: 'https://goerli.basescan.org',
apiURL: "https://api-goerli.basescan.org/api",
browserURL: "https://goerli.basescan.org",
},
},
],
},
mocha: {
timeout: 90 * 1000,
},

namedAccounts: {
deployer: 0,
Expand All @@ -119,28 +122,28 @@ const config: HardhatUserConfig = {
},

gasReporter: {
currency: 'USD',
enabled: process.env.REPORT_GAS === 'true' ? true : false,
currency: "USD",
enabled: process.env.REPORT_GAS === "true" ? true : false,
excludeContracts: [],
src: './contracts',
src: "./contracts",
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
},
networks,
paths: {
artifacts: './artifacts',
cache: './cache',
sources: './src',
tests: './test',
deploy: './deploy',
artifacts: "./artifacts",
cache: "./cache",
sources: "./src",
tests: "./test",
deploy: "./deploy",
},

solidity: {
version: '0.8.17',
version: "0.8.17",
settings: {
metadata: {
// Not including the metadata hash
// https://github.com/paulrberg/hardhat-template/issues/31
bytecodeHash: 'none',
bytecodeHash: "none",
},
// Disable the optimizer when debugging
// https://hardhat.org/hardhat-network/#solidity-optimizer-support
Expand All @@ -151,8 +154,8 @@ const config: HardhatUserConfig = {
},
},
typechain: {
outDir: 'typechain',
target: 'ethers-v5',
outDir: "typechain",
target: "ethers-v5",
},
};

Expand Down
Loading

0 comments on commit e53fb19

Please sign in to comment.