lesson 15 hardhat deploy error #2727
Answered
by
alymurtazamemon
khodehSoroush
asked this question in
Q&A
-
when I try to deploy update-front-end.js hardhat doesn't deploy it and says just nothing to compile ! 👇 my update-front-end.js deploy script 👇 const { ethers, network } = require("hardhat");
const fs = require("fs");
const frontEndContractsFile =
"../nft-marketplace-nextjs-moralis/constants/networkMapping.json";
module.exports = async function () {
if (process.env.UPDATE_FTONT_END) {
console.log("updating front end ...");
await updateContractAddresses();
}
};
async function updateContractAddresses() {
const nftMarketplace = await ethers.getContract("NftMarketplace");
const chainId = network.config.chainId.toString();
const contractAddresses = JSON.parse(
fs.readFileSync(frontEndContractsFile, "utf8")
);
if (chainId in contractAddresses) {
if (
!contractAddresses[chainId]["NftMarketplace"].includes(
nftMarketplace.address
)
) {
contractAddresses[chainId][NftMarketplace].push(nftMarketplace.address);
}
} else {
contractAddresses[chainId] = { NftMarketplace: [nftMarketplace.address] };
}
fs.writeFileSync(frontEndContractsFile, JSON.stringify(contractAddresses));
}
module.exports.tags = ["all", "frontend"]; I'd be glad to help me with this problem🫂 |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Sep 20, 2022
Replies: 1 comment 2 replies
-
@khodehSoroush Is this value is true in env file |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
khodehSoroush
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@khodehSoroush Is this value is true in env file
UPDATE_FTONT_END