Skip to content

Commit b985d47

Browse files
committed
Preparing draft PR for review with deployer that uses both a ledger and programattic wallet
1 parent 4c7ff1a commit b985d47

14 files changed

+7722
-4108
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ config/*.env
1515

1616
src/gen
1717
src/artifacts
18+
scripts/local_output.json
1819

1920
# MAC OS custom directory attributes file.
2021
.DS_Store
@@ -25,6 +26,7 @@ src/artifacts
2526

2627
# Ignore any environmental files with sensitive data
2728
.env
29+
.env.localhost
2830
.env.devnet
2931
.env.testnet
3032
.env.mainnet

Diff for: .prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"singleQuote": true,
66
"trailingComma": "none",
77
"arrowParens": "avoid",
8-
"printWidth": 80
8+
"printWidth": 120
99
}

Diff for: hardhat.config.ts

+29-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { HardhatUserConfig } from 'hardhat/config'
2-
import { networkConfig } from './utils/config-loader'
1+
import { HardhatUserConfig } from 'hardhat/config';
2+
import { networkConfig } from './utils/config-loader';
33

4-
import '@nomiclabs/hardhat-truffle5'
5-
import '@nomiclabs/hardhat-ethers'
6-
import '@nomiclabs/hardhat-web3'
7-
import '@nomiclabs/hardhat-etherscan'
8-
import '@nomicfoundation/hardhat-chai-matchers'
4+
import '@nomiclabs/hardhat-truffle5';
5+
import '@nomiclabs/hardhat-ethers';
6+
import '@nomiclabs/hardhat-web3';
7+
import '@nomiclabs/hardhat-etherscan';
8+
import '@nomicfoundation/hardhat-chai-matchers';
99

10-
import 'hardhat-gas-reporter'
11-
import 'solidity-coverage'
12-
import { HardhatConfig } from 'hardhat/types'
10+
import 'hardhat-gas-reporter';
11+
import 'solidity-coverage';
12+
import { HardhatConfig } from 'hardhat/types';
1313

14-
require('dotenv').config()
14+
require('dotenv').config();
1515

1616
const ganacheNetwork = {
1717
url: 'http://127.0.0.1:8545',
1818
blockGasLimit: 6000000000
19-
}
19+
};
2020

2121
const config: HardhatUserConfig = {
2222
solidity: {
@@ -37,16 +37,25 @@ const config: HardhatUserConfig = {
3737
},
3838
networks: {
3939
// Define here to easily specify private keys
40-
devnet: validateEnvironment()
40+
localhost: loadAndValidateEnvironment('localhost')
4141
? {
42-
url: 'https://rpc.dev.immutable.com',
42+
url: 'http://127.0.0.1:8545',
4343
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
4444
}
4545
: {
4646
url: 'SET ENVIRONMENT VARIABLES',
4747
accounts: []
4848
},
49-
testnet: validateEnvironment()
49+
devnet: loadAndValidateEnvironment('devnet')
50+
? {
51+
url: 'https://rpcx.dev.immutable.com',
52+
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
53+
}
54+
: {
55+
url: 'SET ENVIRONMENT VARIABLES',
56+
accounts: []
57+
},
58+
testnet: loadAndValidateEnvironment('testnet')
5059
? {
5160
url: 'https://rpc.testnet.immutable.com',
5261
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
@@ -89,10 +98,11 @@ const config: HardhatUserConfig = {
8998
gasPrice: 21,
9099
showTimeSpent: true
91100
}
92-
}
101+
};
93102

94-
export default config
103+
export default config;
95104

96-
function validateEnvironment(): boolean {
97-
return !!process.env.DEPLOYER_PRIV_KEY && !!process.env.WALLET_IMPL_CHANGER_PRIV_KEY
105+
function loadAndValidateEnvironment(network: string): boolean {
106+
require('dotenv').config({ path: `.env.${network}` });
107+
return !!process.env.DEPLOYER_PRIV_KEY && !!process.env.WALLET_IMPL_CHANGER_PRIV_KEY;
98108
}

0 commit comments

Comments
 (0)