01_Deploy_NFTToken.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Signer } from "ethers";
  2. import { DeployFunction } from "hardhat-deploy/types";
  3. import { HardhatRuntimeEnvironment } from "hardhat/types";
  4. import { NFTToken, NFTToken__factory } from "../typechain";
  5. const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
  6. let accounts: Signer[];
  7. let nftTokenContract: NFTToken;
  8. accounts = await hre.ethers.getSigners();
  9. console.log(await accounts[0].getAddress());
  10. const tokenFactory = (await hre.ethers.getContractFactory(
  11. "NFTToken",
  12. accounts[0]
  13. )) as NFTToken__factory;
  14. nftTokenContract = await tokenFactory.deploy();
  15. console.log(
  16. `The address the Contract WILL have once mined: ${nftTokenContract.address}`
  17. );
  18. console.log(
  19. `The transaction that was sent to the network to deploy the Contract: ${nftTokenContract.deployTransaction.hash}`
  20. );
  21. console.log(
  22. "The contract is NOT deployed yet; we must wait until it is mined..."
  23. );
  24. await nftTokenContract.deployed();
  25. console.log("Minted...");
  26. };
  27. export default func;
  28. func.id = "nft_token_deploy";
  29. func.tags = ["local"];