Files
hardhat-template/scripts/deploy.ts
Paul Razvan Berg e35b229b5a feat: initial commit
2020-07-07 01:37:20 +03:00

30 lines
1.1 KiB
TypeScript

// We require the Buidler Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
// When running the script with `buidler run <script>` you'll find the Buidler
// Runtime Environment's members available in the global scope.
import { ethers } from "@nomiclabs/buidler";
import { Contract, ContractFactory } from "ethers";
async function main(): Promise<void> {
// Buidler always runs the compile task when running scripts through it.
// If this runs in a standalone fashion you may want to call compile manually
// to make sure everything is compiled
// await run("compile");
// We get the contract to deploy
const Greeter: ContractFactory = await ethers.getContractFactory("Greeter");
const greeter: Contract = await Greeter.deploy("Hello, Buidler!");
await greeter.deployed();
console.log("Greeter deployed to: ", greeter.address);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error: Error) => {
console.error(error);
process.exit(1);
});