2021-02-02 14:38:11 +03:00
|
|
|
// We require the Hardhat Runtime Environment explicitly here. This is optional
|
2021-02-01 16:40:32 +03:00
|
|
|
// but useful for running the script in a standalone fashion through `node <script>`.
|
|
|
|
//
|
|
|
|
// When running the script with `hardhat run <script>` you'll find the Hardhat
|
|
|
|
// Runtime Environment's members available in the global scope.
|
2021-02-02 14:38:11 +03:00
|
|
|
const hre = require('hardhat')
|
2021-02-01 16:40:32 +03:00
|
|
|
|
|
|
|
async function main() {
|
|
|
|
// Hardhat always runs the compile task when running scripts with its command
|
|
|
|
// line interface.
|
|
|
|
//
|
2021-02-02 14:38:11 +03:00
|
|
|
// If this script is run directly using `node` you may want to call compile
|
2021-02-01 16:40:32 +03:00
|
|
|
// manually to make sure everything is compiled
|
|
|
|
// await hre.run('compile');
|
|
|
|
|
|
|
|
// We get the contract to deploy
|
2021-02-02 14:38:11 +03:00
|
|
|
const Greeter = await hre.ethers.getContractFactory('Greeter')
|
|
|
|
const greeter = await Greeter.deploy('Hello, Hardhat!')
|
2021-02-01 16:40:32 +03:00
|
|
|
|
2021-02-02 14:38:11 +03:00
|
|
|
await greeter.deployed()
|
2021-02-01 16:40:32 +03:00
|
|
|
|
2021-02-02 14:38:11 +03:00
|
|
|
console.log('Greeter deployed to:', greeter.address)
|
2021-02-01 16:40:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// We recommend this pattern to be able to use async/await everywhere
|
|
|
|
// and properly handle errors.
|
|
|
|
main()
|
|
|
|
.then(() => process.exit(0))
|
2021-02-02 14:38:11 +03:00
|
|
|
.catch((error) => {
|
|
|
|
console.error(error)
|
|
|
|
process.exit(1)
|
|
|
|
})
|