deploy.ts 940 B

1234567891011121314151617181920212223
  1. import { Contract } from "@ethersproject/contracts";
  2. // We require the Hardhat Runtime Environment explicitly here. This is optional but useful for running the
  3. // script in a standalone fashion through `node <script>`. When running the script with `hardhat run <script>`,
  4. // you'll find the Hardhat Runtime Environment's members available in the global scope.
  5. import { ethers } from "hardhat";
  6. import { Greeter__factory } from "../typechain";
  7. async function main(): Promise<void> {
  8. const Greeter: Greeter__factory = await ethers.getContractFactory("Greeter");
  9. const greeter: Contract = await Greeter.deploy("Hello, Buidler!");
  10. await greeter.deployed();
  11. console.log("Greeter deployed to: ", greeter.address);
  12. }
  13. // We recommend this pattern to be able to use async/await everywhere and properly handle errors.
  14. main()
  15. .then(() => process.exit(0))
  16. .catch((error: Error) => {
  17. console.error(error);
  18. process.exit(1);
  19. });