tornado-trees/scripts/sample-script.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-02-02 12:38:11 +01:00
// We require the Hardhat Runtime Environment explicitly here. This is optional
2021-02-01 14:40:32 +01: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 12:38:11 +01:00
const hre = require('hardhat')
2021-02-01 14:40:32 +01:00
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
2021-02-02 12:38:11 +01:00
// If this script is run directly using `node` you may want to call compile
2021-02-01 14:40:32 +01:00
// manually to make sure everything is compiled
// await hre.run('compile');
// We get the contract to deploy
2021-02-02 12:38:11 +01:00
const Greeter = await hre.ethers.getContractFactory('Greeter')
const greeter = await Greeter.deploy('Hello, Hardhat!')
2021-02-01 14:40:32 +01:00
2021-02-02 12:38:11 +01:00
await greeter.deployed()
2021-02-01 14:40:32 +01:00
2021-02-02 12:38:11 +01:00
console.log('Greeter deployed to:', greeter.address)
2021-02-01 14:40:32 +01: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 12:38:11 +01:00
.catch((error) => {
console.error(error)
process.exit(1)
})