redpacket_v1_deploy.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // We require the Hardhat Runtime Environment explicitly here. This is optional
  2. // but useful for running the script in a standalone fashion through `node <script>`.
  3. //
  4. // When running the script with `npx hardhat run <script>` you'll find the Hardhat
  5. // Runtime Environment's members available in the global scope.
  6. const hre = require("hardhat");
  7. async function main() {
  8. // Hardhat always runs the compile task when running scripts with its command
  9. // line interface.
  10. //
  11. // If this script is run directly using `node` you may want to call compile
  12. // manually to make sure everything is compiled
  13. // await hre.run('compile');
  14. // We get the contract to deployi
  15. const RedPacket = await hre.ethers.getContractFactory("HappyRedPacketV1");
  16. const redPacket = await RedPacket.deploy();
  17. await redPacket.deployed();
  18. console.log("RedPacketV1 deployed to:", redPacket.address);
  19. }
  20. // We recommend this pattern to be able to use async/await everywhere
  21. // and properly handle errors.
  22. main()
  23. .then(() => process.exit(0))
  24. .catch((error) => {
  25. console.error(error);
  26. process.exit(1);
  27. });