Skip to content

Instantly share code, notes, and snippets.

@AryanGodara
Last active January 5, 2024 19:10
Show Gist options
  • Save AryanGodara/f06366abfd35f467e20dfb674a12db2f to your computer and use it in GitHub Desktop.
Save AryanGodara/f06366abfd35f467e20dfb674a12db2f to your computer and use it in GitHub Desktop.
import { getAddress } from "@zetachain/protocol-contracts";
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
if (hre.network.name !== "zeta_testnet") {
throw new Error(
'๐Ÿšจ Please use the "zeta_testnet" network to deploy to ZetaChain.'
);
}
const [signer] = await hre.ethers.getSigners();
if (signer === undefined) {
throw new Error(
`Wallet not found. Please, run "npx hardhat account --save" or set PRIVATE_KEY env variable (for example, in a .env file)`
);
}
const systemContract = getAddress("systemContract", "zeta_testnet");
const factory = await hre.ethers.getContractFactory("MainNFT");
const contract = await factory.deploy(systemContract);
await contract.deployed();
if (args.json) {
console.log(JSON.stringify(contract));
} else {
console.log(`๐Ÿ”‘ Using account: ${signer.address}
๐Ÿš€ Successfully deployed contract on ZetaChain.
๐Ÿ“œ Contract address: ${contract.address}
๐ŸŒ Explorer: https://athens3.explorer.zetachain.com/address/${contract.address}
`);
}
};
task("deploy", "Deploy the contract", main).addFlag(
"json",
"Output in JSON"
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment