Skip to content

Commit

Permalink
Remove infura dependence in contracts-core (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
garyghayrat authored Apr 22, 2024
1 parent 4e3efd4 commit 89826a5
Showing 1 changed file with 12 additions and 25 deletions.
37 changes: 12 additions & 25 deletions contracts-core/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { resolve } from 'path';
dotenvConfig({ path: resolve(__dirname, './.env') });

import { HardhatUserConfig } from 'hardhat/config';
import { NetworkUserConfig } from 'hardhat/types';
import './tasks/accounts';
import './tasks/clean';

Expand Down Expand Up @@ -39,13 +38,6 @@ if (!process.env.MNEMONIC) {
mnemonic = process.env.MNEMONIC;
}

let infuraApiKey = '';
if (!process.env.INFURA_ID) {
console.warn('Please set your INFURA_ID in a .env file');
} else {
infuraApiKey = process.env.INFURA_ID;
}

let etherscanApiKey = '';
if (!process.env.ETHERSCAN_VERIFICATION_API_KEY) {
console.warn('Please set your ETHERSCAN_API_KEY in a .env file');
Expand All @@ -55,26 +47,12 @@ if (!process.env.ETHERSCAN_VERIFICATION_API_KEY) {

const shouldReportGas = process.env.REPORT_GAS === 'true';

function createTestnetConfig(network: keyof typeof chainIds): NetworkUserConfig {
const url = `https://${network}.infura.io/v3/${infuraApiKey}`;
return {
accounts: {
count: 10,
initialIndex: 0,
mnemonic,
path: "m/44'/60'/0'/0",
},
chainId: chainIds[network],
url,
};
}

const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
networks: {
hardhat: {
forking: {
url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
url: String(process.env.SEPOLIA_RPC_URL),
},
chainId: chainIds.hardhat,
accounts: {
Expand All @@ -97,7 +75,16 @@ const config: HardhatUserConfig = {
chainId: chainIds['sepolia'],
url: 'http://127.0.0.1:8545',
},
sepolia: createTestnetConfig('sepolia'),
sepolia: {
accounts: {
count: 10,
initialIndex: 0,
mnemonic,
path: "m/44'/60'/0'/0",
},
chainId: chainIds['sepolia'],
url: String(process.env.SEPOLIA_RPC_URL),
},
mainnet: {
accounts: {
count: 10,
Expand All @@ -106,7 +93,7 @@ const config: HardhatUserConfig = {
path: "m/44'/60'/0'/0",
},
chainId: chainIds['mainnet'],
url: `https://mainnet.infura.io/v3/${infuraApiKey}`,
url: String(process.env.MAINNET_RPC_URL),
gasPrice: 60000000000, // 60 gwei
},
polygon: {
Expand Down

0 comments on commit 89826a5

Please sign in to comment.