scripts/deploy.js (18 lines of code) (raw):
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
async function main() {
async function deploy(name, ...args) {
const Factory = await hre.ethers.getContractFactory(name);
const contract = await Factory.deploy(...args);
await contract.deployed();
console.log(name, "deployed to:", contract.address);
return contract;
}
const token = await deploy("LDToken", "Learning&Development Token", "LDT");
await deploy("Deposit", token.address);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});