Skip to content

Commit

Permalink
Preparing draft PR for review with deployer that uses both a ledger a…
Browse files Browse the repository at this point in the history
…nd programattic wallet
  • Loading branch information
shirren committed Dec 8, 2023
1 parent 4c7ff1a commit b985d47
Show file tree
Hide file tree
Showing 14 changed files with 7,722 additions and 4,108 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ config/*.env

src/gen
src/artifacts
scripts/local_output.json

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

# Ignore any environmental files with sensitive data
.env
.env.localhost
.env.devnet
.env.testnet
.env.mainnet
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"printWidth": 80
"printWidth": 120
}
48 changes: 29 additions & 19 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { HardhatUserConfig } from 'hardhat/config'
import { networkConfig } from './utils/config-loader'
import { HardhatUserConfig } from 'hardhat/config';
import { networkConfig } from './utils/config-loader';

import '@nomiclabs/hardhat-truffle5'
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-web3'
import '@nomiclabs/hardhat-etherscan'
import '@nomicfoundation/hardhat-chai-matchers'
import '@nomiclabs/hardhat-truffle5';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-web3';
import '@nomiclabs/hardhat-etherscan';
import '@nomicfoundation/hardhat-chai-matchers';

import 'hardhat-gas-reporter'
import 'solidity-coverage'
import { HardhatConfig } from 'hardhat/types'
import 'hardhat-gas-reporter';
import 'solidity-coverage';
import { HardhatConfig } from 'hardhat/types';

require('dotenv').config()
require('dotenv').config();

const ganacheNetwork = {
url: 'http://127.0.0.1:8545',
blockGasLimit: 6000000000
}
};

const config: HardhatUserConfig = {
solidity: {
Expand All @@ -37,16 +37,25 @@ const config: HardhatUserConfig = {
},
networks: {
// Define here to easily specify private keys
devnet: validateEnvironment()
localhost: loadAndValidateEnvironment('localhost')
? {
url: 'https://rpc.dev.immutable.com',
url: 'http://127.0.0.1:8545',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
}
: {
url: 'SET ENVIRONMENT VARIABLES',
accounts: []
},
testnet: validateEnvironment()
devnet: loadAndValidateEnvironment('devnet')
? {
url: 'https://rpcx.dev.immutable.com',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
}
: {
url: 'SET ENVIRONMENT VARIABLES',
accounts: []
},
testnet: loadAndValidateEnvironment('testnet')
? {
url: 'https://rpc.testnet.immutable.com',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
Expand Down Expand Up @@ -89,10 +98,11 @@ const config: HardhatUserConfig = {
gasPrice: 21,
showTimeSpent: true
}
}
};

export default config
export default config;

function validateEnvironment(): boolean {
return !!process.env.DEPLOYER_PRIV_KEY && !!process.env.WALLET_IMPL_CHANGER_PRIV_KEY
function loadAndValidateEnvironment(network: string): boolean {
require('dotenv').config({ path: `.env.${network}` });
return !!process.env.DEPLOYER_PRIV_KEY && !!process.env.WALLET_IMPL_CHANGER_PRIV_KEY;
}
Loading

0 comments on commit b985d47

Please sign in to comment.