Skip to content

Commit

Permalink
improve CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
thegostep committed Feb 19, 2021
1 parent 544a17a commit e96f6cc
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ETHEREUM_ARCHIVE_URL=''
CMC_APIKEY=''
ETHERSCAN_APIKEY=''
INFURA_ID=''
INFURA_SECRET=''
DEV_MNEMONIC=''
GRAPH_KEY=''
25 changes: 17 additions & 8 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,47 @@ import './tasks/aludel'
import './tasks/uniswap'
import './tasks/mock'
import './tasks/transmuter'
import './tasks/wallet'

import { Wallet } from 'ethers'
import { HardhatUserConfig } from 'hardhat/config'
import { parseUnits } from 'ethers/lib/utils'

require('dotenv').config()

const mnemonic = process.env.DEV_MNEMONIC || ''
const archive_node = process.env.ETHEREUM_ARCHIVE_URL || ''

export default {
networks: {
hardhat: {
allowUnlimitedContractSize: true,
forking: {
url: process.env.ETHEREUM_ARCHIVE_URL,
url: archive_node,
},
accounts: {
mnemonic:
process.env.DEV_MNEMONIC || Wallet.createRandom().mnemonic.phrase,
mnemonic,
},
},
goerli: {
url: 'https://goerli.infura.io/v3/' + process.env.INFURA_ID,
accounts: {
mnemonic:
process.env.DEV_MNEMONIC || Wallet.createRandom().mnemonic.phrase,
mnemonic,
},
},
mainnet: {
url: 'https://mainnet.infura.io/v3/' + process.env.INFURA_ID,
accounts: {
mnemonic:
process.env.DEV_MNEMONIC || Wallet.createRandom().mnemonic.phrase,
mnemonic,
},
gasPrice: parseUnits('130', 'gwei').toNumber(),
},
alchemist: {
url:
'https://eth-mainnet.gateway.pokt.network/v1/5f3453978e354ab992c4da79',
accounts: {
mnemonic,
},
},
},
solidity: {
compilers: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@uniswap/v2-core": "^1.0.1",
"chai": "^4.3.0",
"dayjs": "^1.10.4",
"dotenv": "^8.2.0",
"ethereum-waffle": "^3.2.2",
"ethers": "^5.0.28",
"hardhat": "^2.0.10",
Expand Down
12 changes: 12 additions & 0 deletions tasks/wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Wallet } from 'ethers'
import { task } from 'hardhat/config'

task('generate', 'Generate random mnemonic')
.addOptionalPositionalParam('token', 'token address')
.setAction(async (args, { ethers }) => {
const wallet = Wallet.createRandom()

console.log('New wallet created')
console.log(' address ', wallet.address)
console.log(' mnemonic', wallet.mnemonic.phrase)
})
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,11 @@ dom-walk@^0.1.0:
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84"
integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==

dotenv@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==

dotignore@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/dotignore/-/dotignore-0.1.2.tgz#f942f2200d28c3a76fbdd6f0ee9f3257c8a2e905"
Expand Down

0 comments on commit e96f6cc

Please sign in to comment.