-
-
Notifications
You must be signed in to change notification settings - Fork 561
/
greeter.ts
16 lines (14 loc) · 832 Bytes
/
greeter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import type { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { task } from "hardhat/config";
import type { TaskArguments } from "hardhat/types";
import type { Greeter } from "../../src/types/Greeter";
import type { Greeter__factory } from "../../src/types/factories/Greeter__factory";
task("deploy:Greeter")
.addParam("greeting", "Say hello, be nice")
.setAction(async function (taskArguments: TaskArguments, { ethers }) {
const signers: SignerWithAddress[] = await ethers.getSigners();
const greeterFactory: Greeter__factory = <Greeter__factory>await ethers.getContractFactory("Greeter");
const greeter: Greeter = <Greeter>await greeterFactory.connect(signers[0]).deploy(taskArguments.greeting);
await greeter.deployed();
console.log("Greeter deployed to: ", greeter.address);
});