update deploy script

This commit is contained in:
0xb337r007 2023-08-10 09:16:42 +02:00
parent 9c2d8527a1
commit 8d3f185bf4
1 changed files with 15 additions and 3 deletions

View File

@ -2,6 +2,8 @@ import { ethers } from "hardhat";
import { pn } from "./utils"; import { pn } from "./utils";
async function main() { async function main() {
const [deployer] = await ethers.getSigners();
const CollectibleV1 = await ethers.getContractFactory("OwnerToken"); const CollectibleV1 = await ethers.getContractFactory("OwnerToken");
const contract = await CollectibleV1.deploy( const contract = await CollectibleV1.deploy(
"Test", "Test",
@ -16,10 +18,20 @@ async function main() {
const instance = await contract.deployed(); const instance = await contract.deployed();
const tx = instance.deployTransaction; const tx = instance.deployTransaction;
const rec = await tx.wait(); const rec = await tx.wait();
console.log( console.log(`OwnerToken deployed at ${instance.address}`);
`OwnerToken deployed at ${instance.address}. Gas used: ${pn(rec.gasUsed)}` console.log(`Gas used: ${pn(rec.gasUsed)}`);
);
console.log("Master token deployed at", rec.events[0].args.masterToken); console.log("Master token deployed at", rec.events[0].args.masterToken);
const mt = await ethers.getContractAt(
"MasterToken",
rec.events[0].args.masterToken
);
console.log("Name:", await instance.name());
console.log("Max Supply:", (await instance.maxSupply()).toString());
console.log("Total Supply:", (await instance.totalSupply()).toString());
console.log(
"Deployer balance:",
(await instance.balanceOf(deployer.address)).toString()
);
} }
// We recommend this pattern to be able to use async/await everywhere // We recommend this pattern to be able to use async/await everywhere
// and properly handle errors. // and properly handle errors.