Skip to content

Instantly share code, notes, and snippets.

@lukecurtis93
Created March 16, 2022 22:23

Revisions

  1. lukecurtis93 created this gist Mar 16, 2022.
    24 changes: 24 additions & 0 deletions deploy.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    const { ethers, upgrades } = require('hardhat');

    async function main() {
    // Hardhat always runs the compile task when running scripts with its command
    // line interface.
    //
    // If this script is run directly using `node` you may want to call compile
    // manually to make sure everything is compiled
    // await hre.run('compile');

    // We get the contract to deploy
    const Contract = await ethers.getContractFactory("MyToken");
    const contract = await upgrades.deployProxy(Contract);
    await contract.deployed();

    console.log("Contract deployed to:", contract.address);
    }

    // We recommend this pattern to be able to use async/await everywhere
    // and properly handle errors.
    main().catch((error) => {
    console.error(error);
    process.exitCode = 1;
    });