Skip to content

Commit

Permalink
Merge pull request #49 from immutable/feat/SMR-2019-1
Browse files Browse the repository at this point in the history
[SMR-2019] Upgrade the deployment scripts to use a hardware ledger
  • Loading branch information
shirren authored Dec 22, 2023
2 parents 2107273 + 84db35a commit cdae5bb
Show file tree
Hide file tree
Showing 46 changed files with 23,826 additions and 17,851 deletions.
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# /prod/imx-evm-relayer/EOA_SUBMITTER
RELAYER_SUBMITTER_EOA_PUB_KEY=0x4bb20797f395Fa9a5eF02A5CB92256B4327F63Ce
# /prod/imx-evm-relayer/IMMUTABLE_SIGNER_CONTRACT
IMMUTABLE_SIGNER_PUB_KEY=0x71639470D21D69456D6e98e7Cc877ABA671ab7fA

# Change this to match the address of the CREATE2 contract factory
DEPLOYER_CONTRACT_ADDRESS=<CHANGE_ME>

# Change the following values to match the values set in the following
# document https://immutable.atlassian.net/wiki/spaces/PRIM/pages/2349203716/PROD+Relayer+Admin+Roles
# for the corresponding environment
MULTICALL_ADMIN_PUB_KEY=<CHANGE_ME_TO_A_PRIVILEGED_TRANSACTION_MULTISIG>
FACTORY_ADMIN_PUB_KEY=<CHANGE_ME_TO_A_PRIVILEGED_TRANSACTION_MULTISIG>
WALLET_IMPL_LOCATOR_ADMIN=<CHANGE_ME_TO_A_PRIVILEGED_TRANSACTION_MULTISIG>
WALLET_IMPL_CHANGER_ADMIN=<CHANGE_ME_TO_A_PRIVILEGED_TRANSACTION_MULTISIG>
SIGNER_ROOT_ADMIN_PUB_KEY=<CHANGE_ME_TO_A_PRIVILEGED_TRANSACTION_MULTISIG>
SIGNER_ADMIN_PUB_KEY=<CHANGE_ME_TO_A_BREAK_GLASS_TRANSACTION_MULTISIG>
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ config/*.env

src/gen
src/artifacts
scripts/*_output*.json

# MAC OS custom directory attributes file.
.DS_Store
Expand All @@ -23,4 +24,9 @@ src/artifacts
.idea
*.iml

.env
# Ignore any environmental files with sensitive data
.env
.env.localhost
.env.devnet
.env.testnet
.env.mainnet
4 changes: 2 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"tabWidth": 2,
"useTabs": false,
"semi": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"printWidth": 130
"printWidth": 120
}
104 changes: 35 additions & 69 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { HardhatUserConfig } from 'hardhat/config'
import { networkConfig } from './utils/config-loader'
import { HardhatUserConfig } from 'hardhat/config';
import { networkConfig } from './utils/config-loader';
import * as dotenv from 'dotenv';

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';

require('dotenv').config()

const ganacheNetwork = {
url: 'http://127.0.0.1:8545',
blockGasLimit: 6000000000
}
dotenv.config();
loadAndValidateEnvironment();

const config: HardhatUserConfig = {
solidity: {
Expand All @@ -33,66 +29,36 @@ const config: HardhatUserConfig = {
},
paths: {
root: 'src',
tests: '../tests'
tests: 'tests'
},
networks: {
// Define here to easily specify private keys
devnet: validateEnvironment()
? {
url: 'https://rpc.dev.immutable.com',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
}
: {
url: 'SET ENVIRONMENT VARIABLES',
accounts: []
},
testnet: validateEnvironment()
? {
url: 'https://rpc.testnet.immutable.com',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
}
: {
url: 'SET ENVIRONMENT VARIABLES',
accounts: []
},
sepolia: networkConfig('sepolia'),
mainnet: networkConfig('mainnet'),
ropsten: networkConfig('ropsten'),
rinkeby: networkConfig('rinkeby'),
kovan: networkConfig('kovan'),
goerli: networkConfig('goerli'),
matic: networkConfig('matic'),
mumbai: networkConfig('mumbai'),
arbitrum: networkConfig('arbitrum'),
arbitrumTestnet: networkConfig('arbitrum-testnet'),
optimism: networkConfig('optimism'),
metis: networkConfig('metis'),
nova: networkConfig('nova'),
avalanche: networkConfig('avalanche'),
avalancheTestnet: networkConfig('avalanche-testnet'),
ganache: ganacheNetwork,
coverage: {
url: 'http://localhost:8555'
}
},
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: networkConfig('mainnet').etherscan
localhost: {
url: 'http://127.0.0.1:8545',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
},
devnet: {
url: 'https://rpc.dev.immutable.com',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
},
testnet: {
url: 'https://rpc.testnet.immutable.com',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
},
mainnet: {
url: 'https://rpc.immutable.com',
accounts: [process.env.DEPLOYER_PRIV_KEY!, process.env.WALLET_IMPL_CHANGER_PRIV_KEY!]
},
},
mocha: {
timeout: process.env.COVERAGE ? 15 * 60 * 1000 : 30 * 1000
},
gasReporter: {
enabled: !!process.env.REPORT_GAS === true,
currency: 'USD',
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(): boolean {
return !!process.env.DEPLOYER_PRIV_KEY &&
!!process.env.WALLET_IMPL_CHANGER_PRIV_KEY &&
!!process.env.DEPLOYER_CONTRACT_ADDRESS;
}
Loading

0 comments on commit cdae5bb

Please sign in to comment.