Created
March 16, 2022 22:23
-
-
Save lukecurtis93/ece251d6c9c7ca9a4608171a4f0c03aa to your computer and use it in GitHub Desktop.
Deploying an upgradable contract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment