Last active
January 5, 2024 19:10
-
-
Save AryanGodara/f06366abfd35f467e20dfb674a12db2f to your computer and use it in GitHub Desktop.
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
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