Skip to content

Commit

Permalink
fix: default value for private key in hardhat c onfig
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Feb 15, 2024
1 parent 63075d6 commit ab8d96c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import '@nomiclabs/hardhat-truffle5';
import '@nomiclabs/hardhat-solhint';
import '@tenderly/hardhat-tenderly';
import '@typechain/hardhat';
import { HardhatNetworkAccountsUserConfig } from 'hardhat/types';
import { parseEther } from 'ethers/lib/utils';

import { parseEther } from 'ethers/lib/utils';
import { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } from 'hardhat/builtin-tasks/task-names';
import { HardhatUserConfig, subtask } from 'hardhat/config';
import { HardhatNetworkAccountsUserConfig } from 'hardhat/types';
import yargs from 'yargs';

import { accounts, etherscanKey, nodeUrl, getPkey } from './utils/network';
import { accounts, etherscanKey, getPkey, nodeUrl } from './utils/network';

// Otherwise, ".sol" files from "test" are picked up during compilation and throw an error
subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(async (_, __, runSuper) => {
Expand Down
9 changes: 4 additions & 5 deletions utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ export function accounts(networkName: string): { mnemonic: string; count: number
}

export function getPkey(): string {
try {
return process.env.DEPLOYER_PRIVATE_KEY!
} catch {
return '0x0000000000000000000000000000000000000000000000000000000000000000'
if (process.env.DEPLOYER_PRIVATE_KEY) {
return process.env.DEPLOYER_PRIVATE_KEY;
} else {
return '0x0000000000000000000000000000000000000000000000000000000000000000';
}

}

0 comments on commit ab8d96c

Please sign in to comment.