From 72133bfba6fd74d366dc0d24b62964ff409c9963 Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Tue, 2 Feb 2021 14:32:44 -0800 Subject: [PATCH] add migration --- .env.example | 2 ++ .gitignore | 1 + hardhat.config.js | 8 +++++++- scripts/sample-script.js | 30 +++++++++++++++++++++++------- 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..a89c7fb --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +PRIVATE_KEY=0x +INFURA_TOKEN= diff --git a/.gitignore b/.gitignore index 784148b..0056edc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules #Hardhat files cache artifacts +.env diff --git a/hardhat.config.js b/hardhat.config.js index 74327d4..a7ebedd 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -1,6 +1,6 @@ /* global task, ethers */ require('@nomiclabs/hardhat-waffle') - +require('dotenv').config() // This is a sample Hardhat task. To learn how to create your own go to // https://hardhat.org/guides/create-task.html task('accounts', 'Prints the list of accounts', async () => { @@ -19,4 +19,10 @@ task('accounts', 'Prints the list of accounts', async () => { */ module.exports = { solidity: '0.6.12', + networks: { + goerli: { + url: `https://goerli.infura.io/v3/${process.env.INFURA_TOKEN}`, + accounts: [process.env.PRIVATE_KEY], + }, + }, } diff --git a/scripts/sample-script.js b/scripts/sample-script.js index a58a1f9..811f578 100644 --- a/scripts/sample-script.js +++ b/scripts/sample-script.js @@ -4,6 +4,9 @@ // When running the script with `hardhat run